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.
you can always find which .ini file is loaded by php using the following handy command
php -i | grep loaded
😀
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.