Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

How do I kill the process running php scripts on a linux box? I'm using Debian with php5.

Sometimes during development a php script will continue to interact with a 3rd party webserver even after I've hit stop on the browser that I was testing it in. If I accidentally write an infinite loop, then it can get pretty annoying for the 3rd party. I can stop my local webserver, but the script usually continues where it left off once I restart the local server. What can I do to stop the script until I run it again?

share|improve this question
    
Need to know if you're using mod_php or cgi in order to tell you what to kill. –  DerfK Jul 20 '11 at 19:51
    
@DerfK - Good question, what command could I run to find out? –  JMC Jul 20 '11 at 20:10
    
@Derfk - php_sapi_name() returns "apache2handler". Does that help? –  JMC Jul 20 '11 at 20:16
    
GATEWAY_INTERFACE = CGI/1.1 –  JMC Jul 20 '11 at 20:24
1  
apache2handler means you're using mod_php which is inside apache. Are you sure the server is stopping? PHP doesn't have any kind of restart ability. Either the command you're giving isn't stopping the server (and its running all the time), or as soon as it comes back up someone is hitting the page and starting the script over again. –  DerfK Jul 20 '11 at 21:40

1 Answer 1

up vote 2 down vote accepted

Setting the max_execution_time in the php.ini may be a better solution than restarting your webserver.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.