virtual server with fcgi and php using shell_exec with max_execution_time


i have create a virtual server with the use of fcgi-php5 which works fine.
i have a script that runs admin tasks and i call it through a web interface.
the issue at start was that after 30 seconds it just stop, after updating the php.ini to that virtual server that did’nt help at last i found the max execution time in the Website Options.
that works if a script runs within its own enviroment for how long that i want.
the issue start when i use the PHP shell_exec() command , it just doesnt work and close the script and returning 500 internal error.

i search the forums and various places and i found out that i might need to update pgp5.fcgi file config to have PHP_FCGI_CHILDREN larger then 2 so the script i am runnig from a web could go to shell and run another script.
i change that with that post that says how to make the file mutable (chatter linux cmd) i changed it to equal 5 - PHP_FCGI_CHILDREN=5 , but it didn’t work.

any ideas on this?
also because of this i get from apache this error: “End of script output before headers: script.php”
i guess its because when it gets to shell_exec() command it just force it to be finished with no warning causing 500 internal server error.

Thank you.
P.S using ubunto 12 on digital ocean


What error are you seeing in your Apache error log for that domain when that issue occurs? You can find he error log in $HOME/logs/error_log.