- 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.
- 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.