Cron Job PHP version issue #495

Closed
opened 2026-04-05 20:28:01 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @muhci on 9/14/2022

CloudPanel version(s) affected

2.0.4

Description

Hi there!
PHP version defined in cron job command (given as stated in official docs) is ignored and if the app is not compatible the upper version of PHP, it's not working:
php7.4 /home/USER/.../script.php => this happens /usr/bin/php
However if I define the command as
/usr/bin/php7.4 /home/USER/.../script.php
it's working.
I figured out this by getting MAIL response to the user's inbox in the /var/mail directory.
You can see the mail output attached.
P.S.: I've encountered the problem with two servers clean installed.

How to reproduce

  1. Define two cron jobs for every minute or something in the panel:
  • php{ANY_VERSION} /home/USER/.../script.php
  • /usr/bin/php{ANY_VERSION} /home/USER/.../script.php
  1. comment out or delete the line MAILTO="" in the file /etc/cron.d/USER
  2. check the cron output in the /var/mail directory.

Possible Solution

The solution could be to correct the guiding placeholder in the panel cron job example and the one in documentation.
Also for user experience I guess it's best to check and add the necessary path to the command (if not pre-defined by the user)

In stackoverflow some guy stated that "... based on its path ..."
I'm not a linux expert. Just solved the problem by trying and then saw that comment...

Thank you for your all efforts.

Additional Context

image

*Originally created by @muhci on 9/14/2022* ### CloudPanel version(s) affected 2.0.4 ### Description Hi there! PHP version defined in cron job command _(given as stated in official docs)_ is ignored and if the app is not compatible the upper version of PHP, it's not working: `php7.4 /home/USER/.../script.php` => this happens /usr/bin/php However if I define the command as `/usr/bin/php7.4 /home/USER/.../script.php` it's working. I figured out this by getting MAIL response to the user's inbox in the **/var/mail** directory. You can see the mail output attached. _P.S.: I've encountered the problem with two servers clean installed._ ### How to reproduce 1. Define two cron jobs for every minute or something in the panel: - php{ANY_VERSION} /home/USER/.../script.php - /usr/bin/php{ANY_VERSION} /home/USER/.../script.php 2. comment out or delete the line **MAILTO=""** in the file /etc/cron.d/USER 3. check the cron output in the **/var/mail** directory. ### Possible Solution The solution could be to correct the guiding placeholder in the panel cron job example and the one in documentation. Also for user experience I guess it's best to check and add the necessary path to the command (if not pre-defined by the user) In [stackoverflow ](https://stackoverflow.com/a/51255499) some guy stated that "... based on its path ..." I'm not a linux expert. Just solved the problem by trying and then saw that comment... Thank you for your all efforts. ### Additional Context ![image](https://user-images.githubusercontent.com/14060891/190138073-b49dbd50-b750-41df-8322-c3575d2a16f0.png)
Sign in to join this conversation.