Start a conversation

Can I use a custom php.ini file for command line PHP scripts?

Yes. When executing a PHP script from the command line, you can use a custom 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 /path/to/alternate/php.ini myscript.php

where /path/to/alternate/php.ini is the full path to the php.ini file you'd like to use. The most common situation where a custom php.ini file is needed is when a user's code requires access to remote URLs. If this is the case, be sure that your custom php.ini file contains the line

allow_url_fopen = On 


Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Support-Agent

  2. Posted

Comments