Reputation: 140
I'm doing some scripting using php, and I need the exec command.which is disabled in disable_functions in php.ini. Is possible to enable it for the command line and keep it disabled for the webserver?
Upvotes: 1
Views: 2108
Reputation: 33532
Sure is, you simply create a second .ini file that is used by the CLI which you can then really simply call via the command to start your PHP script like this:
php -c /home/username/public_html/php.ini /home/username/public_html/myscript.php
This then forces PHP to use the second .ini file and you can enable/disable whatever you like. I would also recommend changing the default timeout value so that your longer running scripts don't time out.
You can also simply use phpinfo()
in a test script from the CLI to ensure that you are using the correct file.
Upvotes: 4