6

I'm working on a web application using PHP, Apache, and MySQL. For the past year the response times of this application have been good. Suddenly yesterday the application became very slow on Firefox (complete page load, including CSS and JavaScript files: around 20 seconds. During page load, Firefox is completely unusable). Interestingly the response times in Internet Explorer were a bit slower (around 2 seconds instead of <1 second).

The strange thing is: The application worked fine two days ago and out of nowhere became very slow. I didn't change anything in the sourcecode. I didn't change a thing in php.ini or httpd.conf. I already log the response times of PHP functions, and that performance hasn't changed.

At first I thought it had something to do with Firefox, so I completely removed Firefox, restarted Windows Vista and did a clean install of Firefox (without extensions). No result.

After testing several things I found out that when I copy the application data to another folder in my document root, the application works fine again. Problem is solved you could think, but it's very annoying that I now have to use another URL and (more important) I don't get it. Why is my application very very very slow in one folder and perfectly fine in another folder?

Does it have something to do with Firefox or with Apache? The name of the folder in which the application is very slow does not appear in either php.ini or httpd.conf.

Black
  • 18,150
  • 39
  • 158
  • 271
jzp74
  • 627
  • 4
  • 9
  • 21

6 Answers6

6

Some suggestions:

  1. Install Fiddler on the client. This will allow you to analyse the low-level HTTP traffic coming from the server.

  2. Extract some of the queries from your PHP code and run them interactively in the MySQL client and see if they're running slowly.

  3. Log into the server (or get a system administrator if you don't have access) and run the Task Manager (Windows) or top (Unix) and make sure there's nothing else hogging the server. If you haven't changed anything, maybe something else has changed on the server. Also, check the server logs/ Event Viewer.

  4. There is a Zend extension called APD that you can install on the server (again, assuming you have rights), and it will profile your PHP code and write out a file showing what functions are being called by your PHP scripts are how long PHP is spending in each function.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ken Keenan
  • 9,818
  • 5
  • 32
  • 49
  • I checked your suggestions (except for the first, and I already created a profiler) but did not find anything unusual. Thanks for your suggestions. – jzp74 Oct 16 '09 at 09:06
4

Look for areas that might cause blocking, like shelling out to curl or opening a file over NFS in the code. If the remove system is timing out, it will drastically affect Apache performance as each request ties up the server for however many seconds it takes to time out and fail the lagging request.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Jeff Ober
  • 4,967
  • 20
  • 15
  • I don't use NFS and all files have correct permissions. If this problem had something to do with time outs response times in IE would be just as bad as in FF – jzp74 Oct 15 '09 at 19:54
  • 1
    What is the *"remove system"*? Can you add a reference to the answer? – Peter Mortensen Oct 25 '19 at 12:59
3

Did you change any network settings in your development setup recently? If so, you might encounter one of Mozillas IPv6 bugs. See this blog entry (taken from this question & answers) for details, and this mozillaZine article for more details and a quick option to test it.

Henrik Opel
  • 19,341
  • 1
  • 48
  • 64
  • 1
    I haven't change any network settings recently. Just to be sure I changed the setting but no change. Thanks for your suggestion. – jzp74 Oct 16 '09 at 16:09
1

I had the same problem. Suddenly even simple sites took about 5 minutes to load.

Cause:

Bad setting in my php.ini

I had to remove this line (or set it to off):

xdebug.remote_autostart=on

Then restart your webserver service.

Black
  • 18,150
  • 39
  • 158
  • 271
  • 1
    +1 You can only add ";" at the beginning of the line or change "on" to "off" in case you need lately to debug your script with xDebug. – Fil Dec 09 '19 at 16:35
  • 1
    It's even better not to load xdebug at all if not required. I was having awful slowdown issues and removing the extension completely solved the problem for me. See https://stackoverflow.com/a/8754934/7268183 – Foaly Apr 21 '21 at 10:44
0

This sounds like a JavaScript issue to me. A PHP request would not make Firefox unusable whereas an errant JavaScript script could very easily do this.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
robjmills
  • 18,438
  • 15
  • 77
  • 121
  • Turning off js doesn't maken any difference. I also removed all js from the page source which didn't make any difference. – jzp74 Oct 16 '09 at 08:59
0

Make sure you didn't forgot the $ signe before any variable inside some loop because Apache create a log error file for each iteration and you run out of disk space. Correct your script and delete the log files may solve your problem.

nino_701
  • 672
  • 3
  • 13