• The new Python extension is now available. It allows customers to deploy and manage WSGI-based Python applications on their websites directly from Plesk.
  • Debian 11 has reached its end-of-life (vendor EOL date - August 31, 2026). Plesk Obsidian 18.0.81 is the last release to support it.
    If you are running Plesk Obsidian on Debian 11, we recommend you upgrade those servers to Debian 12 using our dist-upgrade tool.
  • We plan to deprecate and remove the support for XML RPC protocol versions earlier than 1.6.9.1 in Plesk Obsidian 18.0.82. We strongly recommend that you update all existing integrations using earlier versions of the XML RPC protocol to comply with the version 1.6.9.1 specification.

Schedule a PHP script

E

EddieA

Guest
Hello everyone,

Centos Linux 2.6.18
Panel version 10.2.0


I would like to know what command should I use to run a PHP script uploaded via FTP everyday at 2 am.

I do now know what command I should use.
The file is located in: /var/www/vhosts/DOMAIN/###/example.php

In all other variables of the form "Schedule a Task" i have:

Minute: 0
Hour: 2
Day of the month: *
Day of the week: *
Month: *


Can you help me with the command?
 
Last edited by a moderator:
Hi EddieA,

I've had that problem recently too - you'll have to tell the command line the full path to PHP on your server. On CentOS it's

/usr/bin/php

so your full command under Scheduled Tasks should look like this:

/usr/bin/php /var/www/vhosts/DOMAIN/###/example.php

Notice there's a space between the actual command and the path to PHP.

Good luck ;-)
 
Thanks for your answer

I would like to know what the command is?

If I open the file on a browser it works perfectly.... I just have to put the url...

I read that it should be something like this:

#!/var/www/vhosts/DOMAIN/###/example.php

But probably is something else like:

open /var/www/vhosts/DOMAIN/###/example.php


Do you know the command???


Greetings,
Eddie

Hi EddieA,

I've had that problem recently too - you'll have to tell the command line the full path to PHP on your server. On CentOS it's

/usr/bin/php

so your full command under Scheduled Tasks should look like this:

/usr/bin/php /var/www/vhosts/DOMAIN/###/example.php

Notice there's a space between the actual command and the path to PHP.

Good luck ;-)
 
That IS the command.

OK so let's assume in your web browser the following file is your file:

http://www.yourdomain.com/test.php

Then you can call it as a scheduled task like this:

/usr/bin/php /var/www/vhosts/yourdomain.com/httpdocs/test.php

Obviously replace test.php with your actual file, and yourdomain.com with your actual domain.
 
Not working

Thank you for your advice but it is not working :(

I think this should be easy ...
 
PHP scripts are usually written so that they execute something that gets displayed in a browser. If you're using PHP as a scripting language for command line execution the results may well be very different. Who write the script, and what does it do?

Also, the first line of the PHP file should start with #! /usr/bin/php I believe (similar to a shell script).
 
Back
Top