Using the system command with an ampersand at the end isn't running the process in the background
I'm making a simple call to restore a mysql backup that takes about 45 minutes to complete on one of my servers.
开发者_如何学编程system("mysql -u$user -p$pass $db < '$file' &");
Running it that way locks my browser and I have to wait until it's finished before I can do anything. This works fine on my other server. What settings could be preventing that from working on the first server?
You still have the "handle" to the output pipes (stdout && stderr) which prevents backgrounding fully.
append a > /dev/null 2>&1
to the end.
精彩评论