Introduction
Sometimes it is necessary to use PHP directly on the command line or as a command in a cron job. When doing this, you may notice that it is using the default PHP settings for the server instead of settings made in your local php.ini or .user.ini.
Procedure
PHP has the "-c" flag that can be issued when calling it, allowing you to use a custom php.ini or .user.ini file.
-c <path>|<file> Look for php.ini file in this directory
You can use this flag to load a custom php.ini file, using the full path to the file, to set settings such as memory_limit, error logging, etc., that exist in a user's folder. For example:
php -c /home/user/public_html/php.ini <command>
Replace "<command>" with the path to your script for the cron job.
Using this, you can make changes to your php.ini using the MultiPHP Editor and your cron or command-line usage of PHP will inherit the same settings. For information on using the MultiPHP Editor, or creating a php.ini, please see this article as well: How To Edit Your php.ini File The Right Way
Comments
0 comments
Article is closed for comments.