All,
I've made changes to my php.ini file so that none of my scripts time out but I believe have an issue that the server that I'm trying to get information from resets my connection. Is there a way to dynamically switch my IP address or something like that to avoid their server resetting my connection? I'm trying to use get_file_contents as I'm crawling through the website. Thanks in advance.
Last edited by treeleaf20; 08-24-2011 at 09:49 PM..
Reason: Gave more information
This isn't going to be a problem with PHP.
What are you going to switch your IP to? If you're talking of your client and you have multiple static addresses, then sure. If its on DHCP, then you can ask for a new one, though typically you get the same one back. If you are referring to your server, then you sure don't want to do that.
Have you tried connecting to your site by address instead of by dns?
So for example, if I wanted to get some information from like yellowpages.com and I was doing multiple file_get_contents and then all of a sudden after a couple minutes (maybe 1 or 2) my connection got reset what would cause this? I'm just doing this through my localhost on my computer so I know that my settings for my php files are ok. When you say connect to the site without dns, are you saying to put in the ip address of yellowpages?
I don't know how to use sockets but haven't tried to use curl yet either. I got a message from localhost that says:
The connection to localhost was interrupted.
My script doesn't output anything, it just does a whole bunch of crawling through webpages and inserts some data into my database. It probably ran for 5 minutes before it gave me this message. I'm also running XAMPP if that makes a difference.
Here is the PHP file:
;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;
; Maximum execution time of each script, in seconds
; http://php.net/max-execution-time
; Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time = 0
; Maximum amount of time each script may spend parsing request data. It's a good
; idea to limit this time on productions servers in order to eliminate unexpectedly
; long running scripts.
; Note: This directive is hardcoded to -1 for the CLI SAPI
; Default Value: -1 (Unlimited)
; Development Value: 60 (60 seconds)
; Production Value: 60 (60 seconds)
; http://php.net/max-input-time
max_input_time = -1
Your web server can have other timeout configurations that may also interrupt PHP execution. Apache has a Timeout directive and IIS has a CGI timeout function. Both default to 300 seconds. See your web server documentation for specific details.
Do I have to do something with the Apache configuration to make it higher then 300 or will the ignore_user_abort not make that relevant?
Your web server can have other timeout configurations that may also interrupt PHP execution. Apache has a Timeout directive and IIS has a CGI timeout function. Both default to 300 seconds. See your web server documentation for specific details.
Do I have to do something with the Apache configuration to make it higher then 300 or will the ignore_user_abort not make that relevant?
You'll need to configure the Apache. Modify the httpd.conf and alter the timeout to 0.
Edit:
Also, you said this is on a localmachine? Why not just execute via CLI instead of through apache?
The first errors are backwards compatibility issues: $obj = &new classObject();. Nothing to worry about at this point.
Change you're database configuration to use 127.0.0.1:3306 for its host.