Call a php script 2x with curl

software development

#1

I tried to call my script with curl from another script so it would run after the main script in the background. Both scripts are on the same site/server. It works great, but only once. If I call it again while it’s running, nothing happens.

Why can’t I call it twice? Can I change it so I can?

Thanks.

Terry


#2

If both scripts are on the same domain, then why are you using curl? Curl is not required if you are accessing your own domain.
Silk

My website


#3

The script is long-running. I want it to run in the background. I can’t use exec(), and I can’t flush… but, I can curl and timeout.

Either way, why I can’t curl more than once?

Terry


#4

[quote]The script is long-running. I want it to run in the background.

[/quote]


You may be running into the dreaded process killer
. It’s not well documented, but long time running in background may get its attention and wrath.

tor.eff.org


#5

Thanks for the suggestion. But, it’s not that long. My test script is only 20 seconds. The first request works fine - it appends the date to a file at the end of it’s run, so I know it’s working. But, I can’t call the script more than once in that 20 seconds. Subsequent requests are ignored until the 20 seconds is up.

The real script would be longer so I will keep the process killer in mind if I can ever get it working at all.

Terry


#6

Hmmm. I beleive the php ini file has an execution time limit, but don’t have a clue to what it is set at(DH Default that is).
You could check the wiki and try using your own php ini file and see if changing the time out would fix it.
I just checked mine and the default is 30 seconds. So its possible that DH default could be less.
Silk

My website


#7

Okay, but mine is running to completion. I just can’t call more than one.

Is it that it’s being called from the same IP, and Apache won’t let multiple requests through for the same IP? Or something else?