How to stop php execution

Source: Internet
Author: User
How to stop php execution I have now developed a collection of php code to collect web page data and save it on the desktop. now I found a problem during the test. when the browser is closed, php is still executing to generate data. The question is: how can I close the browser or click the stop button next to the url in the browser to stop php code execution?


Reply to discussion (solution)

By default, php stops execution when it is disabled. are you using ajax to request php?

No ajax is used to reply to the upstairs

Close the browser and stop the current PHP operation.

We recommend that you check the problem from several perspectives:
1. check whether the browser process is complete.
2. in Linux, when different WEB services are used, check whether the configuration is correct and whether the browser is closed due to the existence of the configuration. However, the current process of the WEB service is still being executed.

Pseudo process?
A lot of people want to make it difficult!
You need to facility and process the termination signals that can be reached in your code

Recently I also found this problem. when the browser is closed, the program will be executed.

However, it should be stopped after the current content is executed.

For local testing, I usually restart the service directly.

We recommend that you use bin to collect data.

Recently I also found this problem. when the browser is closed, the program will be executed.

However, it should be stopped after the current content is executed.

For local testing, I usually restart the service directly.

We recommend that you use bin to collect data.

What does the bin method mean? Please advise

Set_time_limit ();

Setting the maximum execution time of scripts is the easiest way.

Well, even though you shut down the browser, the commands of the program have long been issued, and before he finishes all the commands, if he didn't stop the command (yes, it is with the underlying layer, server-related commands, not browser management), the previous unfinished commands will continue to be executed, knowing that the commands are completed or forced to stop (such as restarting the server or restarting the web service program)

Add exit ().

Well, this problem also occurs in my collection. I closed my browser and kept going. I guess it is related to the working mechanism of php curl. the specific reason is unclear.

I cannot log out of my computer at first. it must be restarted.
It may be because of the http protocol. In the end, I can close the browser process in the process. In addition, I think it is okay to close the apache service. I have never tried it.

The program sets the maximum execution time for a long time. sleep is used in the program to prevent the collection from sending an ip address too quickly. it doesn't matter if this is the same.

The program sets the maximum execution time for a long time. sleep is used in the program to prevent the collection from sending an ip address too quickly. it doesn't matter if this is the same. Visual testing has nothing to do with this. php curl supports proxy.

It has nothing to do with this, but it has something to do with your program writing. because you have not seen your program, you cannot make it clear.

Generally speaking:
When the browser is closed, the program will terminate (php also has a function to change this behavior), which is conditional.
This condition means that the program must have an output.
Php checks whether the user's connection is disconnected only when there is output.

Check whether the browser process is closed in the task manager to discuss more advanced problems.

It usually takes a few minutes for me to close my browser and the process will end ......

The solution is still not found. only restart apache can be terminated.

Is the php command line method, and it is best to use it in Linux, stable.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.