• 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
  • Please beaware of a breaking change in the REST API on the next Plesk release (18.0.62).
    Starting from Plesk Obsidian 18.0.62, requests to REST API containing the Content-Type header with a media-type directive other than “application/json” will result in the HTTP “415 Unsupported Media Type” client error response code. Read more here

Scheduled Tasks - PHP script doesn't work

Webbenny

Basic Pleskian
Hello,

I have created a scheduled task, that should run a php script from my httpdocs directory. When I run the script in the same menu where I created it, it works perfect. No errors. If I run the same script from the list of scheduled tasks, it doesn't work. The same if it runs automatically at the scheduled time.

I got the following error:
Code:
-: /opt/plesk/php/5.4/bin/php: No such file or directory

Any idea what's wrong here?
 
Hi Webbenny,

please be aware, that the standard setting for a domain - specific webuser is the execution in a chrooted environment. If this user isn't allowed to execute scripts outside the chroot, then you will notice issues as described.

To check if the defined user for that crontab is allowed to run scripts, consider to check the settings:

grep 'username' /etc/passwd

To change the settings for a specific user, please use the Plesk Control Panel and define the desired access for the user ( "Web Hosting Access" ).
 
That's interesting... I was under the impression that the "Run a PHP script" option was created to avoid chrooted shell issues... especially when it gives you the option to select which PHP version to use. Why should Plesk say "hey go ahead and select from 3 version of PHP that are installed" but then fail to execute the binaries?

It seems counter-intuitive. Screenshot to illustrate.
 

Attachments

  • run a php script.png
    run a php script.png
    15.8 KB · Views: 3
Back
Top