Blaine0002 Posted April 6, 2010 Share Posted April 6, 2010 I have a script that loops 150 times and enters information to my database. The information is pulled from another website using cURL so it takes awhile to load then enter. I have been wanting to use the code exec("/usr/bin/php /var/www/script.php >/dev/null &"); for awhile, but when i use it it skips or times out on some of the loops making a partial database. THOUGH, when i run /usr/bin/php /var/www/script.php through putty, it runs perfectly, ( not in the background or anything) but it doesnt miss any loops. Am i missing something here? Link to comment https://forums.phpfreaks.com/topic/197810-difference-between-exec-and-running-via-putty/ Share on other sites More sharing options...
trq Posted April 6, 2010 Share Posted April 6, 2010 The first one will execute via Apache's user, the second, will execute as you. Link to comment https://forums.phpfreaks.com/topic/197810-difference-between-exec-and-running-via-putty/#findComment-1038060 Share on other sites More sharing options...
Blaine0002 Posted April 6, 2010 Author Share Posted April 6, 2010 I am not using apache, im running cherokee. Even so, what would cause certain loops to time out? Link to comment https://forums.phpfreaks.com/topic/197810-difference-between-exec-and-running-via-putty/#findComment-1038063 Share on other sites More sharing options...
trq Posted April 6, 2010 Share Posted April 6, 2010 I am not using apache, im running cherokee My point was that it would execute as your servers users. Even so, what would cause certain loops to time out? Maybe your server is timing out? Are you executing the script by requesting it from a browser? Maybe that's timing out. It could be anything, but without seeing the code within the script all we can do is make guesses. Link to comment https://forums.phpfreaks.com/topic/197810-difference-between-exec-and-running-via-putty/#findComment-1038064 Share on other sites More sharing options...
Blaine0002 Posted April 6, 2010 Author Share Posted April 6, 2010 I am not using apache, im running cherokee My point was that it would execute as your servers users. Even so, what would cause certain loops to time out? Maybe your server is timing out? Are you executing the script by requesting it from a browser? Maybe that's timing out. It could be anything, but without seeing the code within the script all we can do is make guesses. Sorry i didnt make it clear enough ^^ Im trying to run a php script via my browser that contains <?php exec("/usr/bin/php /var/www/script.php >/dev/null &"); ?> this doesnt time out, and it creates a process that runs script.php It enters information into my database, but random loops fail to execute (for some unknown reason). but after those loops, the next loop runs fine. i guess this means the script doesnt time out? plus i thought that anything ran through CLI isnt supposed to time out at all. Cant post my code (sorry) ill write up something that recreates my problem and post it ASAP. Link to comment https://forums.phpfreaks.com/topic/197810-difference-between-exec-and-running-via-putty/#findComment-1038066 Share on other sites More sharing options...
Blaine0002 Posted April 6, 2010 Author Share Posted April 6, 2010 huh sometimes i just need someone to smack me and tell me im stupid. it was my cURL options i did this. $options = array( CURLOPT_CONNECTTIMEOUT => 9999999, // timeout on connect CURLOPT_TIMEOUT => 9999999 // timeout on response ); Link to comment https://forums.phpfreaks.com/topic/197810-difference-between-exec-and-running-via-putty/#findComment-1038069 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.