Base PHP version + PHPswitcher & setting PHP environment in cron job script?

  • Sorry but I can't help you further… I don't use compiled versions…

    Seems like the compiled version is not going to read Environment Variables when launched from cli.


    One last step could be to create your personal custom php.ini file for your cli cron:

    1. copy your actual php.ini to phpxyz.ini

    2. edit phpxyz.ini and change

    Code
    1. ; sys_temp_dir = "/tmp"

    to

    Code
    1. sys_temp_dir = "/my/desired/tmp/dir"

    then try to launch your cron with:

    Code
    1. */5 * * * * /opt/phpswitcher/20200223/php7.2/bin/php -c /path/to/phpxyz.ini /var/www/virtual/your-whmcs-domain.xxx/00_private/crons/cron.php
  • thank you kess, I will try that!

    but would it be possible to install only PHP CLI (7.2) package from sources in addition to the existing PHP 7.0 and only use it for this cronjob via the /bin path?

  • I guess best solution would be to change from compiled to packaged-only ... do I have to uninstall/re-install PHPswitcher first in that case?

    Code
    1. perl /var/www/imscp/gui/plugins/PhpSwitcher/PhpCompiler/php_compiler.pl --register --packaged --packaged-only