Details
-
Type: Improvement
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 4.0.0
-
Fix Version/s: 4.2.0-b1
-
Component/s: Staff Interface
-
Labels:None
Description
Under Settings > System > Automation, the path to PHP is hard coded as /usr/bin/php but this is not always the correct path to PHP. Additionally, the command does not currently direct the output to /dev/null, so it may result in emails being generated by the cron.
There is a constant called PHP_BINDIR which should show the path to the directory. For example, if PHP is in /usr/bin/php, it should return /usr/bin and we can append "/php". See http://php.net/manual/en/reserved.constants.php
There is another constant called PHP_BINARY which is suppose to show the full path in PHP 5.4+, but it returned nothing in my tests.
So, this may not be a foolproof way to determine the path to PHP, but it's better than always assuming it's /usr/bin/php
Additionally, " >/dev/null 2>&1" should be appended to the end of the cron command.
PHP_BINARY is set at run time
PHP_BINDIR is set at compile time
Since php does not have to be located in the place it was compiled, we would have to look at PHP_BINARY if we were to try to determine this path.