Improve PHP performance with FastCGI on XAMPP for Windows

I have been using XAMPP on Windows for development for many years and found it to work quite well. Unfortunately performance is not that great.

By default XAMPP uses Mod-PHP to execute PHP within the Apache process. Changing this to use FastCGI improves performance by creating separate Windows tasks to run the PHP processes.

My XAMPP is installed into C:\Apps\xampp\ – adjust for your own environment.

First determine if you are running 32-bit or 64-bit XAMPP using phpinfo() by checking the Architecture (x86 is 32-bit, x64 is 64-bit).

Note the Server API is Apache 2.0 Handler – this is what we are replacing.

Download the latest version of mod_fcgid from Apache Lounge ( You will need either or depending on your Architecture.

Copy the file from the ZIP archive to the XAMPP apache\modules directory. In my XAMPP installation this was C:\Apps\xampp\apache\modules.

Stop Apache in the XAMPP Control Panel and edit the Apache configuration file C:\Apps\xampp\apache\conf\extra\httpd-xampp.conf to change the PHP-Module setup to use FastCGI.

# PHP-Module setup
LoadFile "C:/Apps/xampp/php/php7ts.dll"
LoadFile "C:/Apps/xampp/php/libpq.dll"
LoadModule php7_module "C:/Apps/xampp/php/php7apache2_4.dll"

<FilesMatch "\.php$">
    SetHandler application/x-httpd-php
<FilesMatch "\.phps$">
    SetHandler application/x-httpd-php-source

Change this section to:

# PHP-Module setup
LoadFile "C:/Apps/xampp/php/php7ts.dll"
LoadFile "C:/Apps/xampp/php/libpq.dll"

LoadModule fcgid_module modules/

<IfModule fcgid_module>
	FcgidInitialEnv PATH "C:/Apps/xampp/php"
	FcgidInitialEnv SystemRoot "C:/Windows"
	FcgidInitialEnv SystemDrive "C:"
	FcgidInitialEnv TEMP "C:/Apps/xampp/tmp"
	FcgidInitialEnv TMP "C:/Apps/xampp/tmp"
	FcgidInitialEnv windir "C:/windows"
	FcgidIOTimeout 64
	FcgidConnectTimeout 16
	FcgidMaxRequestsPerProcess 1000 
	FcgidMaxProcesses 3
	FcgidMaxRequestLen 8131072
	# Location php.ini:
	FcgidInitialEnv PHPRC "C:/Apps/xampp/php"
	FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 1000

	<Files ~ "\.php$">
		Options Indexes FollowSymLinks ExecCGI 
		AddHandler fcgid-script .php
		FcgidWrapper "C:/Apps/xampp/php/php-cgi.exe" .php

Change the phpMyAdmin section to enable FastCGI to avoid forbidden exceptions:

    Alias /phpmyadmin "C:/Apps/xampp/phpMyAdmin/"
    <Directory "C:/Apps/xampp/phpMyAdmin">

        # add this option allow FastCGI
        Options ExecCGI

        AllowOverride AuthConfig
        Require local
        ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var

Start Apache in the XAMPP Control Panel and check phpinfo() to check that FastCGI is enabled.

Something to note is that when stopping the Apache process, the XAMPP Control Panel will not stop any PHP processes that have been started. These php-cgi.exe processes will need to be killed in Task Manager. This is only a problem if you need to restart PHP, for example if you update php.ini.



Need help? Let me take care of your IT issues.

Share this page

Scroll to Top