Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am running XAMPP on Windows Vista. XAMPP is a ~one year old install with all default options.

I wrote a script in PHP that will do a web crawl and place data in mysql. I placed set_time_limit(36000) in the PHP-source code so that the script will not time out. However, because I am launching the script by directing my browser to the PHP file, it seems that the browser (Chrome and Firefox) times out; and then the script stops (i.e. the script runs fine for about a minute and then stops).


  1. I don't understand if it is possible to run php from the command line with my current configuration. In the cmd prompt, I typed: php -v and got 'php' is not recognized as an internal or external command.
  2. If question 1 is true, how do I run PHP from the command prompt? Otherwise, what else can I do that won't cause a timeout?
share|improve this question

closed as off-topic by Tom O'Connor Aug 14 '13 at 21:23

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must be relevant to professional system administration. Server Fault is a site dedicated to professionals; novice questions are off-topic. Please see the Help Center for more information on topicality. The best advice we can give you is to hire a professional to help you out." – Tom O'Connor
If this question can be reworded to fit the rules in the help center, please edit the question.

  1. You haven't added PHP to the PATH environment variable in Windows. See the PHP docs for general instructions on getting PHP to work from the command line on Windows. Basically, if you want to use PHP from the command line, you need to add the directory containing the PHP executable (probably C:\xampp\php in your case) to your PATH variable. Take a look at this guide for instructions on how to make changes to your PATH variable.
  2. At the moment, you should be able to run PHP from the command prompt by typing C:\xampp\php\php.exe but once you've correctly set the PATH variable as in step 1 above, you should be able to simply type php at the command prompt.

To address the issue of PHP timing out when you run your script from a browser, it's unlikely to be an issue caused by your browser. There are two separate php.ini configuration files; one applies to the command-line instance of PHP, and the other applies to the instance of PHP that Apache uses, so make sure you've changed the correct file. Another thing to bear in mind is that Apache must be restarted for the configuration change to take effect; your best bet is to simply restart the entire stack.

Finally, is there any particular reason you're using XAMMP rather than WAMP? Unless you're making use of the Perl programming language, I suggest you rather download the WAMP installer, which is fully integrated and will setup all of the required environmental variables for you, and comes with great community support.

Edit: I've just noticed that you didn't actually mention changing any settings in your php.ini file, so I think this is probably your problem with the timeouts. In your php.ini file you'll find a setting for max_execution_time which is specified in seconds. Change this to a value that you think will more accurately allow your script to finish processing, for example, set it to max_execution_time = 300 to allow your scripts to run for a maximum of 5 minutes before timing out. Again, remember to restart Apache after making this change.

For the record, performing any sort of web crawling with a PHP script called from a browser is a terrible idea. You should rather run this as a console application.

share|improve this answer

You should be able to run php from the command prompt. You'll either need to navigate within your XAMPP install folder to where the php.exe lives, or add that directory to your PATH environmental variable.

I have an old installation of WAMP, and found it at C:\wamp\bin\php\php5.3.0\php.exe:

C:\wamp\bin\php\php5.3.0>php.exe -v
PHP 5.3.0 (cli) (built: Jun 29 2009 21:25:23)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies
share|improve this answer

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