Jump to content

Difference between exec and running via putty?


Blaine0002

Recommended Posts

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?

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.

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.

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
);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.