PHP ini issues for scripts running in CLI or executing shell_exec() in *nix

Did you try to run php from command line and faced with php exception like safe mood is on, memory limit exceeded, maximum execution time exceeded etc. A general solution is to edit the php.ini and made those changes and restart apache server. At least i found these solutions online đŸ™‚

But that is not gonna solve your problem. when you are running CLI or shell_exec in *nix environment, php uses a different php.ini file located inside CLI folder. until you edit that the problem wont be solved. So if you are constantly getting errors after altering your php.ini file used by your web server then you should try your CLIs’ php.ini file for any issues regarding cron/CLI.

Advertisements
Posted in: PHP

2 thoughts on “PHP ini issues for scripts running in CLI or executing shell_exec() in *nix

  1. mcdba says:

    I had a perl program which ran fine from command line but not using shell_exec(), exec() or system() – nothing was being returned. I was using the full path and permissions were set correctly.

    It turned out the perl program was using more memory than my PHP.INI file was set to allow. Increasing “memory_limit” solved the problem.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s