如何在php-web page centos服务器的后台运行exec()命令

I prepared my setup on ubuntu and everything is working fine on my local server(i.e ubuntu as weel as mint).

But when i transferred my files to centos server .....i am not able to execute exec() or system command in background.( i changed the permission of program too)

I used following command in ubuntu:

$pid=system("./programme.exe {$arg1} {$arg2} {$arg3}>output.txt & echo $!");

Could anyone explain why not this is not working on centos(in background)....... but system("./programme.exe {$arg1} {$arg2} {$arg3}) ; works fine............

I'm not sure, but it could be because of system runs a program and redirects the output back. In your command, you redirecting aswell, so maybe php is waiting for the output. Try using exec instead of system.

exec($cmd . " > /dev/null &");