1

I have a form with about 25 inputs and the code to process it. The last time the code was edited in any way was 3 weeks ago. I randomly started getting reset connection issues. To investigate, I began cutting out sections of the code to find the guilty sections (cut section, refresh, repeat). Once I narrowed it down to a particular section (one which when I cut it out, the error did not occur), I started to repeat the process with smaller sections of the culprit section. Finally, I had the entire section commented out. Still got the error. Then I deleted the commented out sections and no error!

This leads me to conclude that the error isn't in my code, but some recent change to the configuration of the server (I host with GoDaddy) or something like that. Any suggestions as to what could cause this error? I've never removed comments from code and fixed an error before.

Further information: The form loads correctly initially. Clicking any of the buttons gives me the error, however the code does completely precess before the error (I do some file in/output so I can see that it's working). This even happens with the "Clear All" button which skips the section I mentioned above, and simply reloads the form.

I am using no database interaction whatsoever. The script does utilize both Facebook and twitter APIs.

I really don't know how to proceed from this point. I'm willing to post the code from the entire file if necessary, but my investigation reveals that to be pointless. I can also provide a link to the offending page.

Update: I commented out all the code except the output of the HTML form itself. No processing code at all. Just one function to output the form. Clicking any button causes the connection reset. However if I delete this commented out code, I do NOT get the connection reset, the form just reloads.

Update #2. I uploaded the site to another host. The code runs fine with no issues.

Update #3. After an exhaustive examination, I've determined that the cause of the problem is the following function call:

preg_replace('/\b(\w)/e', 'strtoupper("$1")', $_POST['dessert_name'])

If I comment out this line, I get the connection reset error... If I delete it, the script runs perfectly.

Lee Blake
  • 341
  • 1
  • 2
  • 15
  • Try these settings in PHP.ini also, you may have to find/remove a coalesced file depending on how they implemented php on shared hosting. memory_limit = 128M upload_max_filesize = 100M allow_url_include = 1 allow_url_fopen = 1 – Moylin Jul 31 '13 at 23:51
  • memory limit is 64M upload_max_file_size = 32M allow_url_include=0 allow_url_fopen=1... those are the current settings. I'm not sure how any of those could be an issue. I have no issue reading from/writing to files anywhere else and the files in question are small(5k max) and there are only a few of them (5 or 6). – Lee Blake Aug 01 '13 at 04:55
  • And changing these values to your suggested values does not alleviate the error. – Lee Blake Aug 01 '13 at 05:27
  • My only advice at this point would be to try and confirm if it's Godaddy. Run the script on a vm php server. Your access/error logs don't have anything though? – Moylin Aug 01 '13 at 08:06
  • It appears it is host related as it executed perfectly on another host. – Lee Blake Aug 01 '13 at 09:40
  • getting the phpinfo() from both hosts reveals only a small number of differences in the php core values, none of which are remotely relevant (enable_dl, variable_order, register_long_arrays, ignore_repeated_errors, ignore_repeated_source, allow_call_time_pass_reference). I'm not sure what else to look for. – Lee Blake Aug 01 '13 at 10:29
  • Well, that's shared hosting for ya. As for identifying the issue, All i could say would be to do as you did, spot every difference on godaddy vs the host where it works. and try to modify those in the php.ini to see what breaks it. I've had situations where memory limit would be 64M but would error out everytime i surpassed 45ish (wordpress) – Moylin Aug 01 '13 at 14:16

1 Answers1

1

You need to increase your php timeout limit in php.ini

This in my experience is almost always a timeout.

max_execution_time = 60

or at the top of your script add

set_time_limit(60);
Moylin
  • 737
  • 1
  • 9
  • 20
  • No luck. I tried setting it to 600, no luck either. It pretty much goes directly to the connection reset screen. No hang or anything. – Lee Blake Jul 31 '13 at 23:43
  • Try resetting the file permissions on your shared hosting, usually shared hosts have that in their account manager. Check to see any oddities in the user/group of the owned files. Does your script do anything like save a file/log something? – Moylin Jul 31 '13 at 23:49
  • I'm assuming you're on shared hosting. So I'd look for an option to reset the file permssions. This will basically assign the correct owner/group for your package to all of the files in it. – Moylin Jul 31 '13 at 23:56
  • However, during my testing, the script worked even with these file I/O sections intact. And didn't work while they were disabled. – Lee Blake Aug 01 '13 at 00:02
  • Did you try the php.ini file changes I additions above under your question? – Moylin Aug 01 '13 at 00:03