XAMPP Running really slowly with PHP/MySQL

20,610

Solution 1

I used to have the same issues with PHP on xampp. After a while it started slowing down, there was no reason for it (code, mysql, apache were all fine).

The way I had gotten it to work was via xampp's command line interface. I had switched the networking interface from v4v6 to just v4; and that that had done the trick, then shortly after it slowed down again... so doing the v4 back to v4v6 fixed, but again worstened.

So, after working with xampp for a number of years, I found that wamp worked best and has no issues on Windows 7.

Download wamp; it's only 16mb too (compared to xampp's 44mb). http://wampserver.com/

Solution 2

I had the same problem. Recent (Jan 2013) installation of XAMPP but same code base as both production server and another development machine. It took 2+ seconds each time PHP connected to MySQL, and in some transactions there were several connections. I tried skip-name-resolve in the my.ini file, this failed completely. I then made a one character change to the hosts file and all worked. Go to c:/windows/system32/drivers/etc. Edit hosts. Remove the # comment character from the local host line (or perhaps add it as below)

# localhost name resolution is handled within DNS itself.
127.0.0.1       localhost

Stopped and restarted MySQL service. This was a complete fix.

Solution 3

For me, the answer was this:

Answer

You need to close xampp program first, then go and right click the xampp_start.exe and xampp-control.exe files in the xampp directory, selecting "properties", then check "Run as administrator" in the "Compatibility" tab. You should run xampp then and click the red buttons (X) to activate as services (Apache and Mysql). As I said, that did the magic for me.

Solution 4

I have faced similar problems so I can help. But with the information provided it may not be feasible to debug further.

Can you use any OS specific tool (you can also start with the task manager) and check what is consuming the most CPU and Memory times respectively? We will need to solve this iteratively and hopefully arrive at a solution.

At this point of time it could be anything - a cpu heavy process, a resource conflict, a disk intensive i/o or just something that is paging/trashing heavily etc.

Solution 5

The simple solution could be to provide IP as the hostname in the database connection. like,

  'hostname' => '127.0.0.1',
  'username' => 'mysql_user',
  'password' => 'mysql_user',
Share:
20,610
Luke
Author by

Luke

I'm a keen website and software developer. I am particularly knowledgeable in C#, .NET Core, WebAPI, HTML, CSS/SCSS, JavaScript, Powershell, Webpack and AWS.

Updated on July 09, 2022

Comments

  • Luke
    Luke almost 2 years

    I've got XAMPP installed on my Windows 7 Computer.

    I've been developing on it for a while now but my development has come to a grinding halt because XAMPP is rendering my PHP pages really slowly.

    It's running so slowly, that it's exceeding the 30 second time-out limit that I've got set in the PHP.ini file.

    I don't know what it could be that has all of a sudden prevented it from running properly.

    I've tried the following:

    • Reinstalled XAMPP and copied back my MySQL database files and website files
    • Deactivated my Antivirus/firewall after reading articles that this might do the trick

    But to no avail.

    Could it be that my MySQL database is corrupted?

    It's not that my MySQL queries are slow, because I've got the exact same version of code live on my website.

    I'm just looking for suggestions to rectify it so that I can continue the development.

    This is the last bit of the MySQL error log

    111119 17:24:11 [Note] Plugin 'FEDERATED' is disabled. 111119 17:24:11 InnoDB: The InnoDB memory heap is disabled 111119 17:24:11 InnoDB: Mutexes and rw_locks use Windows interlocked functions 111119 17:24:11 InnoDB: Compressed tables use zlib 1.2.3 111119 17:24:11 InnoDB: Initializing buffer pool, size = 16.0M 111119 17:24:11 InnoDB: Completed initialization of buffer pool 111119 17:24:11 InnoDB: highest supported file format is Barracuda. 111119 17:24:12 InnoDB: Waiting for the background threads to start 111119 17:24:13 InnoDB: 1.1.8 started; log sequence number 1595675 111119 17:24:14 [Note] Event Scheduler: Loaded 0 events 111119 17:24:14 [Note] c:\xampp\mysql\bin\mysqld.exe: ready for connections. Version: '5.5.16' socket: '' port: 3306 MySQL Community Server (GPL) 111119 17:32:24 [Note] c:\xampp\mysql\bin\mysqld.exe: Normal shutdown

    111119 17:32:24 [Note] Event Scheduler: Purging the queue. 0 events 111119 17:32:24 InnoDB: Starting shutdown... 111119 17:32:25 InnoDB: Shutdown completed; log sequence number 1595675 111119 17:32:25 [Note] c:\xampp\mysql\bin\mysqld.exe: Shutdown complete

    111119 17:33:26 [Note] Plugin 'FEDERATED' is disabled. 111119 17:33:26 InnoDB: The InnoDB memory heap is disabled 111119 17:33:26 InnoDB: Mutexes and rw_locks use Windows interlocked functions 111119 17:33:26 InnoDB: Compressed tables use zlib 1.2.3 111119 17:33:26 InnoDB: Initializing buffer pool, size = 16.0M 111119 17:33:26 InnoDB: Completed initialization of buffer pool 111119 17:33:26 InnoDB: highest supported file format is Barracuda. 111119 17:33:27 InnoDB: Waiting for the background threads to start 111119 17:33:28 InnoDB: 1.1.8 started; log sequence number 1595675 111119 17:33:28 [Note] Event Scheduler: Loaded 0 events 111119 17:33:28 [Note] c:\xampp\mysql\bin\mysqld.exe: ready for connections. Version: '5.5.16' socket: '' port: 3306 MySQL Community Server (GPL)

  • Luke
    Luke over 12 years
    Thank you for the response. There is literally no CPU being taken up when it's just sat there. When loading the page, at it's peak 10% of the CPU is being used up when reloading any of the pages.
  • Deer Womb
    Deer Womb over 12 years
    I hate shooting the dark like this but I had a peculiar problem a while back where anytime I would run any Eclipse based IDE at the same time as the DB, I would see that the system was slowing down. I don't quite remember the prognosis then, but just something to remember before trying out more.
  • Deer Womb
    Deer Womb over 12 years
    ##a. Open Performance troubleshooter - click Start button, and then Control Panel. In the search box, type troubleshooter, and click Troubleshooting. Under System and Security, click Check for performance issues. Tell me if you see any pointers. ##b. Try using "Process Explorer" from System Internals and enable each column (i.e. I/O Delta Total Bytes - for Disk I/O) individually (Goto Process Explorer, View -> Select Columns, Process Performance & enable). Do this to get values for processor and memory use, Disk I/O etc (overall and for each process) and see if anything spectacular pops up.
  • CD001
    CD001 about 11 years
    Been having the same issue -does appear to be somehow related to resolving MySQL to localhost. Changing "localhost" to "127.0.0.1" in my database connector object did the trick; this seems like a better system-wide solution though :)