mardi 5 mai 2015

Linux Plesk scheduled task of php script

I am trying to execute a php script that is on my domain. I am trying to create a scheduled task to run this. I have the path of the .php file as

/httpdocs/api/cron.php

When i enter only this as the command i recieve a message (by email) saying

/httpdocs/api/cron.php: line 1: ?php: No such file or directory

/httpdocs/api/cron.php: line 2: /bin: is a directory

/httpdocs/api/cron.php: line 3: cron.php: command not found

And so on. From what i have read i need to first enter the path to php.exe on the server. I dont know the path to the file. From the php.ini file, that i saw by opening a .php, i found

_SERVER["PATH"]
/sbin:/usr/sbin:/bin:/usr/bin

I then tried the command

/usr/bin/php -f /httpdocs/api/cron.php

But by email i got an error saying

-: /usr/bin/php: No such file or directory

I have tried many variations also

php /httpdocs/api/cron.php

but all return similar errors.

Please could someone advise the correct command to to execute the cron.php file.

Aucun commentaire:

Enregistrer un commentaire