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'); 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 &'); 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? 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 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" 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
Archived
This topic is now archived and is closed to further replies.