• Halloween is coming! To celebrate the occasion, we dusted off a couple of old skins, and even created a brand new one (Pixel).
    To get into the festive spirit, install the Skins extension.
  • The new Python extension is now available. It allows customers to deploy and manage WSGI-based Python applications on their websites directly from Plesk.
  • The Plesk Mobile apps for iOS and Android and the Plesk Mobile Center extension have been deprecated, and are no longer available for new installations. In Plesk Obsidian 18.0.84, the Plesk Mobile Center extension will be removed from servers during the upgrade, and the Plesk Mobile apps will lose their server management features.
  • The Social Login extension has been deprecated and will be removed in Plesk Obsidian 18.0.84. After that, it will no longer be possible to log in to Plesk with a Google, Facebook, GitHub account, or with a passkey. Plesk usernames and passwords, as well as logging in with a WebPros Account, are not affected.

User account can't run cron?

J

JDub@

Guest
Hi,

I'm having some trouble running a cron script as a user within Plesk 7.5.4. The target file is being found fine, but I'm unable to access PHP in order to run it.

Upon running the following command: -

/usr/local/psa/admin/bin/php /var/www/vhosts/domain/httpdocs/tasks_minute.php5

I get the following error in the email sent to me: -

/bin/sh: /usr/local/psa/admin/bin/php: Permission denied

Server cron runs fine, but then they run as root!

Why is this? Am I pointing to the wrong PHP, or should I run this as a server cron? I don't really want to, as it only applies to a specific domain.

Any help on this would be MUCH appreciated!!

Regards

Jules.
 
Wrong PHP. It's a pretty safe assumption that anything user related will not be under /usr/local/psa/admin

Try 'which php' to find the "real" version of PHP. Also, you will probably need the -f flag in your command.
 
Many thanks for the feedback - Quick Q's: -

Where do I search for 'which php'?
Also what syntax is the -f flag entered - i.e. where in the command string?

Regards

Jules.
 
just type the following in a shell (SSH):
which php

The -f flag is a php flag, so it would go after php, and before the file name. For example:

php -f /var/www/vhosts/domain/httpdocs/tasks_minute.php5
 
Many thanks for your help there - I haven't solved the problem yet, but I'm a few steps closer!! :)

Out of curiosity, what does the -f flag do?

Regards

Jules.
 
root@ns ~>php -h
Usage: php [-q] [-h] [-s] [-v] [-i] [-f <file>]
php <file> [args...]
-a Run interactively
-C Do not chdir to the script's directory
-c <path>|<file> Look for php.ini file in this directory
-n No php.ini file will be used
-d foo[=bar] Define INI entry foo with value 'bar'
-e Generate extended information for debugger/profiler
-f <file> Parse <file>. Implies `-q'
-h This help
-i PHP information
-l Syntax check only (lint)
-m Show compiled in modules
-q Quiet-mode. Suppress HTTP Header output.
-s Display colour syntax highlighted source.
-v Version number
-w Display source with stripped comments and whitespace.
-z <file> Load Zend extension <file>.
 
Hello,

Try on the crom command:

/usr/bin/php /home/httpd/vhosts/domain/httpdocs/path/file.php >/dev/null

and check that your php file starts with:

#!/usr/local/bin/php -q

Hope this helps.

Cheers,

DXTrim
 
Many thanks for the input folks. My developer managed to suss it out with the input of the poster above - It took a little more shuffling around, but this was the final command that appears to the job: -

(pushd '/var/www/vhosts/domain/httpdocs'; /usr/bin/php -e -f tasks_minute.php5; popd)

Cheers

J>
 
Back
Top