php on fast chi max execution time and shell_exec child spawn issues

Hi all.
I’m really facing a weird issue.
When creating a virtual sever I select fcgi as the php parser and on website options I made the php script execution time unlimited. Also configuring the php ini file which is linked to that specific virtual sever.
If in the script I am running there is any delay like many functions or even php sleep() command it works.

The problem is when running a script that uses shell_exec() command which I use to run admin stuff in the server. The script just hang and in the error log it says the script ended before headers were sent.
I tried to modify the fcgi-php5 file for max spawned childs. IT didn’t work.
Anyone has an idea what should i do?