Specify a Cron Job to Use a Specific phpini File
If you are using assistive technology and are unable to read any part of the HostMonster website, or otherwise have difficulties using the HostMonster website, please call 866-573-HOST and our customer service team will assist you.
Skip to main content

HostMonster Web Hosting Help

Specify a Cron Job to Use a Specific phpini File

Specify a Cron Job to use a Specific php.ini File

Summary

This article will explain how to set a Cron Job to use a specific php.ini file. If you need a different explanation on Cron Jobs, please refer to this list of Cron Job articles:


Some scripts executed with a Cron Job requires a specific php.ini file to be used.

When executing a PHP script from a Cron Job (or via the command line), you can use a custom php.ini file. The most common situation where a custom php.ini file is needed is when a user's code requires access to something such as Zend Optimizer, which is specified in the php.ini file.

Specifying the php.ini File

To specify an alternate php.ini file, you'll need to use the -c flag in your PHP command line.

For example:

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

In this instance, /home/username/public_html/php.ini is the full path to the php.ini file you'd like to use and /home/username/public_html/myscript.php is the full path to the php script you'd like to run. Using your actual username, change the path to the php.ini and the file you intend to run accordingly

Note: Your home directory may be home1, home2, home3, etc.

Knowledgebase Article 225,205 views bookmark tags: command cron cronjob crontab custom line optimizer php zend


Was this resource helpful?

Did this resolve your issue?


Please add any other comments or suggestions about this content:





Recommended Help Content

Error Log receiving this error: PHP Warning: Zend Optimizer for PHP 4.4.x cannot be found (expected at '/usr/local/Zend/lib/Optimizer-2.5.10/php-4.4.x/ZendOptimizer.so') - try reinstalling the Zend Op
Knowledgebase Article 155,785 views tags: found optimizer zend

How do I enable the Zend Optimizer on my account?
Knowledgebase Article 175,519 views tags: optimizer php zend

This article will explain how to run php and other file types using Cron jobs.
Knowledgebase Article 523,848 views tags: cron file jobs php

Related Help Content

This article will explain how to setup, remove, or edit a Cron Job.
Knowledgebase Article 374,726 views tags: cron crontab job

Learn how the Cron Job tool can help you automate the scripts on your web site.
Video "How-to" Tutorial 347,897 views tags: cpanelutilities cron

How to run cron jobs at a specific "local" date and time.
Knowledgebase Article 175,787 views tags: cron time

I get this with some of my php files: Fatal error: Unable to read X bytes in /<home_directory>/public_html/myfile.php on line Y
Knowledgebase Article 183,659 views tags: fatal php read unable

Changing PHP versions, load custom Apache mods, and other Apache/PHP customizations
Knowledgebase Article 152,863 views tags: easyapache php vps whm

This article will instruct you how to export a database from the command line (SSH).
Knowledgebase Article 862,481 views tags: database mysql ssh

This article will instruct you how to import a database from the command line (SSH).
Knowledgebase Article 775,755 views tags: database mysql ssh

The php.ini file can be viewed from a web browser.
Knowledgebase Article 155,662 views tags: exploit hide php prevent

This site utilizes JavaScript to function correctly. Looks like it's disabled on your browser. Please enable it for your best experience.

For instructions on enabling JavaScript, click here