Jump to content

issue with cron job session files - goes to system folder /tmp


Recommended Posts

after changing to PHP 7.2 I have a problem with the cron jobs, because I have installed several PHP versions and the main system is running w/ PHP 7.0 so I need to use the path in the command line just for the cron jobs:

*/5 * * * * /opt/phpswitcher/php7.2/bin/php -q /var/www/virtual/mydomain.tld/crons/cron.php

If I run the cron jobs as the web owner (user) all of the cron job sessions go to the system main /tmp folder, so today I have found about thousands of cron session files inside.

WHMCS or better the website is using a phpswitcher and works without any issues ... all website or whmcs sessions are stored in the phptmp session folder of the webfolder, it just happens with the cron jobs.
Is there a way to set a special session path for the cron jobs?

Edited by cluster
Link to comment
Share on other sites

41 minutes ago, cluster said:

after changing to PHP 7.2 I have a problem with the cron jobs, because I have installed several PHP versions and the main system is running w/ PHP 7.0 so I need to use the path in the command line just for the cron jobs:


*/5 * * * * /opt/phpswitcher/php7.2/bin/php -q /var/www/virtual/mydomain.tld/crons/cron.php

If I run the cron jobs as the web owner (user) all of the cron job sessions goes to the system main /tmp folder, so today I have found about thousands of cron session files inside.

WHMCS or better the website is using a phpswitcher w/ PHP 7.2 and works without any issues ... all website or whmcs sessions are stored in the phptmp session folder of the webfolder, it just happens with the cron jobs.
Is there a way to set a special session path for the cron jobs ... or can I run the cron jobs with the main PHP 7.0 environment and the whmcs website under PHP 7.2?

 

Edited by cluster
Link to comment
Share on other sites

  • 2 months later...

Hi,

Add a php.ini file to the command in the cron command line.

*/5 * * * * /opt/phpswitcher/php7.2/bin/php -c /var/www/virtual/mydomain.tld/conf/php.ini /var/www/virtual/mydomain.tld/crons/cron.php

See the added parameter in bold.

I would use the same php.ini that the control panel generates for the site, which will cause the cron to execute in the exact same environment as the website.

HTH

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated