• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved trouble setting up scheduled task: /opt/plesk/php/7.0/bin/php: No such file or directory

jmano

New Pleskian
Hello,

trying to set up a cron job for magento in one of my plesk user subscriptions.

Here is my setup:

Screen Shot 2016-09-30 at 10.56.11.png

when i try to run this job i get this error:

Task "/var/www/vhosts/mymagentodir/bin/magento" completed with error in 0 seconds, output:

-: /opt/plesk/php/7.0/bin/php: No such file or directory

the directory certainly exists so what am i missing here ? (i have to admit that i am not super skilled in setting up cron jobs :oops: )
 
not yet, i'm reading up on cron jobs now since for the moment i don't know how to do it via command line, in my old server/shop with magento 1.9 on plesk 11 i managed to set it up via plesk like that
 
Just login as root via ssh on your Plesk server and run command

# /var/www/vhosts/mymagentodir/bin/magento

Check output. Also if talk about Plesk 11 version, there is no multiple PHP feature (it was released in Plesk 12.x versions). Therefore, most probably you really have no /opt/plesk/php/7.0/bin/php file there.
 
when i run
Code:
/var/www/vhosts/mymagentodir/bin/magento cron:run

as root from the shell i get a permission denied error

btw, i am on Plesk 12.5.3 on this new server, Plesk 11 was on the old server
 
Last edited:
ok, i found a solution here: https://kb.plesk.com/en/115889

after running
Code:
/usr/local/psa/bin/server_pref --update -crontab-secure-shell ""

the task executes without erros when running it from plesk :)

as far as i understand a Plesk user is not allowed to access directories above it's vhost directory and the above command disables this limitation for cron.
 
as far as i understand a Plesk user is not allowed to access directories above it's vhost directory and the above command disables this limitation for cron.
Yes, you are correct.
 
This solution works for me as well.
Correct me if I am wrong please but it seems to me to open a world of possibilities for getting control of the server from a hacked user level!
 
Hi,
I´m a little confused, to run magento 2.3 cronjob i need two forms to run php:

A
* * * * * /opt/plesk/php/7.3/bin/php /var/www/vhosts/AAAAA.com/httpdocs/bin/magento setup:cron:run >> /var/www/vhosts/AAAA.com/httpdocs/var/log/setup.cron.log

* * * * * /opt/plesk/php/7.3/bin/php /var/www/vhosts/AAAAA.com/httpdocs/update/cron.php >> /var/www/vhosts/AAAAA.com/httpdocs/var/log/update.cron.log
B
* * * * * /opt/psa/admin/bin/php /var/www/vhosts/AAAA.com/httpdocs/bin/magento cron:run 2>&1 | grep -v "Ran jobs by schedule" >> /var/www/vhosts/AAAAA.com/httpdocs/var/log/magento.cron.log

Why?
When i use the form /opt/plesk/php/7.3/bin/php in B cronjob ever have a error
 
Last edited:
Back
Top