mysql - run php script in background centos server -
i want php file run in background. when googled found exec() used run in background. using cent os server. in order use exec basic things should install. don't know how run in terminal. steps should follow run php script in background using exec().
i found ex on google dont know use in $cmd.
function execinbackground($cmd) { if (substr(php_uname(), 0, 7) == "windows"){ pclose(popen("start /b ". $cmd, "r")); } else { exec($cmd . " > /dev/null &"); } }
you can use nohup in terminal:
nohup php my-file.php
your php script keep running after logout.
the other option screen.
screen -a -m -d -s whatever ./phplauncher.sh
Comments
Post a Comment