使用shell_exec在php中运行后台脚本

I was running a php script in background, and what I tried:

shell_exec('nohup php C:\wamp\www\Management_software\application\views\testcron.php  > /dev/null & echo $!');

This is working fine when I opened up the command prompt(cmd) and tried:

php C:\wamp\www\Management_software\application\views\testcron.php

But this is not working from the php page, how to solve this or any other techniques or what are the modifications I have to make ?

This might help you debug the problem. exec can take 3 arguments and those help in identifying what's going on.

Try with

exec('nohup php C:\wamp\www\Management_software\application\views\testcron.php  > /dev/null & echo $!', $op, $er); 
echo $er;` 

and see what gets printed on the page. If the value of $er is greater than 0, then something is wrong.

For list of exit codes, refer this list