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).
![](https://paulshipley.id.au/wp-content/uploads/2019/06/FastCGI-before.jpg)
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
(https://www.apachelounge.com/download/).
You will need either mod_fcgid-x.x.x-win32-VCxx.zip
or mod_fcgid-x.x.x-win64-VCxx.zip
depending on your Architecture.
![](https://paulshipley.id.au/wp-content/uploads/2019/06/FastCGI-download.jpg)
Copy the mod_fcgid.so
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> <FilesMatch "\.phps$"> SetHandler application/x-httpd-php-source </FilesMatch>
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/mod_fcgid.so <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 </Files> </IfModule>
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 </Directory>
Start Apache in the XAMPP Control Panel and check phpinfo()
to check that FastCGI is enabled.
![](https://paulshipley.id.au/wp-content/uploads/2019/06/FastCGI-after.jpg)
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
.
References:
http://www.sintesisdigital.com.mx/dashboard/docs/use-php-fcgi.html
https://www.apachelounge.com/download/
https://gist.github.com/basilfx/51cea37d10f4f4d68c74681d01f72e07