473,503 Members | 10,322 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to terminate a script

93 New Member
I've got a script which uses cURL to connect to another website, and it seems to be getting stuck (I can't quite figure out how, but that's besides the point!). The trouble is that when my script runs it redirects you to a "please wait" page, and it then executes by itself. So you can't click 'stop' in your browser to terminate the script. If the script gets a fatal error, then the 'results' page will display an error saying that the script failed. If the script finishes successfully then obviously the 'results' page will have the results on it.

But my script appears to get stuck, and just never produces a results page, and never produces an error. So it must still be executing. The script wouldn't necessarily time out because time spent doing cURL connections doesn't count towards the script's execution time. And despite my cURL settings, cURL doesn't seem to timeout either. So my script is stuck in eternal limbo, which worries me because I've now probably got several scripts all running forever on my webserver! (Deleting the php file doesn't help, because php appears to store it in ram in order to execute it, so it keeps running even after you've deleted it.)

So to get to the point.....

How can I get php to terminate everything its doing (i.e. all scripts that its running) without shutting down the webserver? I can't shut down the web server because it's on a paid hosting thing, and I don't have that kind of access to it (only cpanel).

What are 'cron jobs'? Could I create one that resets php?
Jul 17 '07 #1
9 2600
mwasif
802 Recognized Expert Contributor
Check out this link to know about cronjob.

Set timeouts (CURLOPT_CONNECTTIMEOUT and CURLOPT_TIMEOUT) for cURL using curl_setopt.
Jul 17 '07 #2
adamalton
93 New Member
Yeah, I'm already using CURLOPT_TIMEOUT, CURLOPT_CONNECTTIMEOUT , CURLOPT_LOWSPEEDLIMIT, and CURLOPT_LOWSPEED_TIME. Which is why I can't understand why it's getting stuck.

I'll have a read about cronjobs
Jul 17 '07 #3
Motoma
3,237 Recognized Expert Specialist
But my script appears to get stuck, and just never produces a results page, and never produces an error. So it must still be executing.
Not necessarily. Take a look at the top post in this forum, it will tell you how to ensure that you receive all error messages for properly debugging php scripts.
Jul 17 '07 #4
adamalton
93 New Member
It appears that my scripts are not getting stuck at all! Quite the opposite...they are failing...silently!

The curl_multi_select() function causes php to fail, without outputting any error message. I've submitted a bug on the php.net site.
Jul 17 '07 #5
Motoma
3,237 Recognized Expert Specialist
It appears that my scripts are not getting stuck at all! Quite the opposite...they are failing...silently!

The curl_multi_select() function causes php to fail, without outputting any error message. I've submitted a bug on the php.net site.
Hrm, could you post a simple test case for us to try out?
Jul 18 '07 #6
adamalton
93 New Member
I'll have more of an investiagtion today, and see if I can post some example code.

The problem is that I'm using the function in a script which is included in another script which is included in another script, and sometimes when the script is included it works and sometimes when it's included it just fails, silently. I can't figure out what makes it fail, but it definitely shouldn't just fail silently.

Here's my bug:
http://bugs.php.net/bug.php?id=42020
Jul 18 '07 #7
tscott
22 New Member
Hmm... Code looks really disorganized to me and there aren't as many {} as there should be, a while statement was ended with a ; . Yeah... that code = :S

Needs to be dubugged.

~Tyler
Jul 20 '07 #8
adamalton
93 New Member
Trust me, the code works. And anyway, if it didn't then php would give an error message, not just self destruct! The strange thing is that the problem never occurs on my own server (Mac OSX) but it does on my webhost's, despite them both having the same php version. I'm going to start a new discussion to get some help with disabling the optimizers etc to see if they are causing the problem.
Jul 20 '07 #9
Motoma
3,237 Recognized Expert Specialist
Trust me, the code works. And anyway, if it didn't then php would give an error message, not just self destruct! The strange thing is that the problem never occurs on my own server (Mac OSX) but it does on my webhost's, despite them both having the same php version. I'm going to start a new discussion to get some help with disabling the optimizers etc to see if they are causing the problem.
Any hopes of us getting a simple test case to demonstrate the bug?
Jul 21 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2354
by: yawnmoth | last post by:
i've written a php script to test proxy servers, but when i run it from the command line, it doesn't terminate. i have to hit Ctrl+C to terminate it. so, any ideas as to what i'm doing wrong, and...
5
36401
by: Helmut Jarausch | last post by:
Hi, I'm still looking for an elegant and clear means to terminate the main script in Python. Unfortunately, Python doesn't allow a 'return' instruction in the main script. Using...
1
2019
by: kk5151 | last post by:
Hi, Do you know any simple script to terminate the iexplorer.exe. On window, I have to go to Task Manager -> processes -> End process of "IExplorer.exe". Currently I have 30 IE browsers running on...
2
2492
by: cnsabar | last post by:
Hi., I am using the following code to terminate the any process by giving the process name as input... use Win32::Process::List; use Win32::OLE; $Win32::OLE::Warn = 3; $P =...
0
1683
by: cnsabar | last post by:
Hi., I need a Perl script to terminate the any running process in server. by specifying computer name and process name.. I have the following code to terminate the any process by specifying...
1
2432
by: thunder54007 | last post by:
hi, here is my script: import win32con import time import wmi c = wmi.WMI() for process in c.Win32_Process(name = "notepad.exe"): print process.ProcessId, process.Name process.Terminate ()
3
3843
by: Gros Bedo | last post by:
Hello :-) I have a question about Python and Linux shell. I have a python program which is permanently resident in the end-user system. I'm currently producing a RPM package, and it works nicely....
1
2972
by: Gros Bedo | last post by:
Yes I've seen that each python script calls its own instance of Python. Buthow to know which is the good one in bash ? Is there a command that gets the parameters of process, so I could use grep to...
0
1996
by: norseman | last post by:
Gros Bedo wrote: ============================== Yes. man ps explains try ps -AFL | grep then kill -9 found (check it more than twice) 1) If your script is known to hang use what...
0
7294
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7361
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7470
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5026
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4693
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3183
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1523
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
749
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
403
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.