Cron Job Setting by Using a Specific php.ini File

Some scripts,done by a Cron Job, require using of a specific php.ini file. If you run PHP script with a Cron Job (or via the command line), you may use a custom php.ini file. One of common situations, where a custom php.ini file is required, is when a user's code wants access to something that is specified in the php.ini file like Zend Optimizer.

Specifying the php.ini File

You should use the -c flag in your PHP command line in order to specify an alternate php.ini file, as the following example:

php -c /home/username/public_html/php.ini /home/username/public_html/myscript.php

Here, the full path to the php.ini file, that you like to use is the following part:/home/username/public_html/php.ini and /home/username/public_html/myscript.php is the full path to the php script, which you want to run.

By your usernameyou can change the path to the php.ini and the file, which you intend to run respectively.

Note: The home directory could be home1, home2, home3 and so on.

Was this article helpful?

mood_bad Dislike 1
mood Like 0
visibility Views: 3527