PHP on Windows with XAMPP running 100 times too slow

42,218

Solution 1

I found the problem was Xdebug in xampp\php\php.ini. Here're the results of trying many solutions found around the web:

Run XAMPP as adminisrator and restart server: 3617 ms

In xampp/apache/conf/httpd.conf, replace localhost with 127.0.0.1 and restart server: 3639 ms

In Windows/System32/drivers/etc/hosts, add “127.0.0.1 127.0.0.1” & “127.0.0.1 localhost” and restart Windows: 3960 ms

In Windows/System32/drivers/etc/hosts, un-comment “127.0.0.1 localhost” and restart Windows: 3659 ms

In php.ini, uncomment zend_extension = "C:\xampp\php\ext\php_eaccelerator_ts.dll" and restart server: 3643 ms

In php.ini, set xdebug.remote_enable=0: 3598 ms

In php.ini, set remote_host="localhost": 3593 ms

In php.ini, set xdebug.profiler_enable=0: 249 ms

In php.ini, comment out all Xdebug statements: 27 ms - Success!

The sad part is, I make mistakes and need Xdebug :-(

Solution 2

I solve my problem with xdebug idekey setting (xdebug.idekey="xdebug1"), and chrome extension xdebug helper (https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc)

*Dont forget to disable remote_autostart (xdebug.remote_autostart=0)

Only activating debug (xdebug) by request, using idekey setting, so if debug not needed php processing can be faster/normal, tonggle by button with chrome extension

I'm using xampp 1.8.3 on windows 10 64bit, i use custom idekey, xdebug.idekey="xdebug1", same with xdebug helper setting

[XDebug]
zend_extension = "E:\xampp183\php\ext\php_xdebug.dll"
xdebug.profiler_append = 0
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "E:\xampp183\tmp"
xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.remote_enable = 1
xdebug.remote_autostart=0
xdebug.idekey="xdebug1"
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "127.0.0.1"
xdebug.trace_output_dir = "E:\xampp183\tmp"
xdebug.remote_log="E:\xampp183\tmp\xdebug\xdebug.log"

setting1

enter image description here

enter image description here

Now breakpoint/debug activated only if session is requsted via xdebug helper

Solution 3

I excluded my website folder and my xampp folder in Windows Defender and things were solved here.

Solution 4

I Had the same problem with xampp, and the problem was WINDOWS DEFENDER, if you disable the windows defender protection, xampp is faster (normal speed), Also you can search the xampp folder as exlusion in windows defender. these is the solution.

Share:
42,218
CaptureWiz
Author by

CaptureWiz

I started writing computer games as a hobby in 1980 while working as an engineer for Xerox. In 1999, I switched to writing software full-time. Here're some of the better programs I've written: QuickieTV.com - Watch the videos you want fit into the time you have. CaptureWiz - Windows tool for capturing images, video and audio. ZoomTools - Suite of graphics utilities for Windows. Speed - Windows program launcher, clock and alarm. On Balance - Broderbund accounting program. Monster Smash - Smash 'em up for the Apple II and Commodore 64.

Updated on July 05, 2022

Comments

  • CaptureWiz
    CaptureWiz almost 2 years

    PHP runs so slowly on my Windows desktop that phpMyAdmin takes minutes to open a database. Here’s a comparison of the time to run a simple PHP test program:

    • Windows 8.1 machine running XAMPP: 3597 ms
    • iPage shared hosting: 65 ms
    • A2Hosting shared hosting: 26 ms

    Here’s the test program…

    <?php
    $rStartTime = microtime(true);
    $countTo = 100000;
    $a = 0;
    //$countTo = $countTo * 100;
    for ($x = 0; $x <= $countTo; $x++) {
        $a = sqrt(pow($x, 2));
    }
    $rMs = floor((microtime(true) - $rStartTime) * 1000);
    echo 'timer done, countTo=' . $a . ' ms=' . $rMs;
    

    The test program is run without debugging, by entering "http://localhost/timer.php" into Firefox.

    The local machine is normally blazing fast. It’s running…

    • Windows 8.1
    • XAMPP 1.8.3 (control panel v3.2.1)
    • Apache 2.4.4 (latest is 2.4.20)
    • PHP 5.5.3
    • Antimalware = Windows Defender
    • IDE = PHPStorm 10.0.2

    What's making PHP run so slowly?