priceey Posted October 31, 2007 Share Posted October 31, 2007 Hello I am currently writing a web interface for a software build. on the final page, it calls a bash script at the moment, the script takes a good 1/2 hour to work, so my final page is taking ages to be displayed. is there any way i can run the script in the background, without having to wait for the page to load? shell_exec('location/of/script'); Quote Link to comment https://forums.phpfreaks.com/topic/75477-calling-a-script-with-php/ Share on other sites More sharing options...
rajivgonsalves Posted October 31, 2007 Share Posted October 31, 2007 you could put a & at the end of the command shell_exec('location/of/script &'); Quote Link to comment https://forums.phpfreaks.com/topic/75477-calling-a-script-with-php/#findComment-381791 Share on other sites More sharing options...
priceey Posted October 31, 2007 Author Share Posted October 31, 2007 that didnt do the trick is there any other way to make the script run, but not wait for it to complete? Quote Link to comment https://forums.phpfreaks.com/topic/75477-calling-a-script-with-php/#findComment-381967 Share on other sites More sharing options...
rajivgonsalves Posted October 31, 2007 Share Posted October 31, 2007 you can try http://php.net/manual/en/function.pcntl-fork.php require addition libraries Quote Link to comment https://forums.phpfreaks.com/topic/75477-calling-a-script-with-php/#findComment-381971 Share on other sites More sharing options...
aschk Posted October 31, 2007 Share Posted October 31, 2007 The bash script itself should call the fork to child process e.g. in bash.sh #!/bin/bash /path/to/otherscript > 2&>1 & echo "Finished" Quote Link to comment https://forums.phpfreaks.com/topic/75477-calling-a-script-with-php/#findComment-381986 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.