This article describes how to use a custom php.ini file for cPanel cron jobs.
Different php.ini files, and therefore different settings, are used depending on how you run a PHP script. For example, scripts run from the command line, and scripts run from a cPanel cron job, run under different environments.
To specify the exact environment for a PHP script in a cPanel cron job, you can define the path to a custom php.ini file. To do this, use the -c option. For example, the following command runs the script.php file using the php.ini file located in the user's config directory:
/usr/local/bin/php -c ${HOME}/config/php.ini ${HOME}/script.php
Subscribe to receive weekly cutting edge tips, strategies, and news you need to grow your web business.
No charge. Unsubscribe anytime.
Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.
We use cookies to personalize the website for you and to analyze the use of our website. You consent to this by clicking on "I consent" or by continuing your use of this website. Further information about cookies can be found in our Privacy Policy.