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.
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

reCapcha doesn't work on my WordPress site. How to fix it?

Question: I have some issues with my reCapcha on my WordPress site, how to fix it. It was just...

Is it possible to get a dedicated IP address for my webpage?

Question: Hello, Is it possible to get a dedicated IP address for my webpage? (I am planning to...

Problem with PHP WordPress memory

Question: I'm trying to increase the php memory limit to 128Mb in order to keep Woocommerce...

Ad banner module does not work in my host

Question: I installed an ad banner module, but gave me the following message:ForbiddenAccess to...

I can't access to my WP installation

Question: After copying the new site files to de main directory, I can not login into my...