PHP FPM - Check if Installed and Running verify task manager

PHP-FastCGI on Windows in XAMPP for PHP Performance

This tutorial guides you on how to install or configure PHP-FastCGI on Windows in XAMPP for PHP performance.

PHP-FastCGI on Windows in XAMPP for PHP Performance

I was trying to improve the PHP performance with FastCGI on XAMPP for Windows. Running PHP with fcgid will give you the following benefits.

  • The fcgid boosts the performance, both in CPU and memory consumption
  • It also creates separate windows tasks to run the PHP processes separately.

The following are the steps that you need to follow to install or configure PHP-FastCGI on Windows in XAMPP.

Note, when you browse through the URL: http://localhost/dashboard/phpinfo.php after installing XAMPP you will notice that the Server API currently configured by default is Apache 2.0 Handler. We are going to replace this with PHP-FCGID module.

Therefore, first you need to download latest version of FastCGI ASF module from the following link

https://www.apachelounge.com/download/

I had downloaded Win64 version of mod_fcgid ie., mod_fcgid-2.3.10-win64-VS16.zip

mod_fcgid
FastCGI ASF module
[mod_fcgid] mod_fcgid-2.3.10-win64-VS16.zip            info         16 Jun '19     45K

[mod_fcgid] mod_fcgid-2.3.10-win32-VS16.zip                                        41K

Install FastCGI in XAMPP on Windows

1: First, stop the Apache service via XAMPP control panel.

2: Then, copy mod_fcgid.so that was extracted from the above zip file to your apache/modules folder

3: Next, create a new configuration file httpd-fcgid.conf in the following path.

C:\xampp\apache\conf\extra\httpd-fcgid.conf

Then copy and paste the following configuration for mod_fcgid.

# Configuration for mod_fcgid
FcgidInitialEnv PHPRC "C:/xampp/php"
FcgidInitialEnv PATH "C:/xampp/php;C:/Windows/System32;C:/Windows;C:/Windows/System32/Wbem;"
FcgidInitialEnv SystemRoot "C:/Windows"
FcgidInitialEnv SystemDrive "C:"
FcgidInitialEnv TEMP "C:/Windows/Temp"
FcgidInitialEnv TMP "C:/Windows/Temp"
FcgidInitialEnv windir "C:/Windows"
FcgidIOTimeout 64
FcgidConnectTimeout 16
FcgidMaxRequestsPerProcess 1000 
FcgidMaxProcesses 50
#FcgidMaxProcessesPerClass 25 
FcgidMaxRequestLen 8131072
# Location php.ini:
FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 1000

<Files ~ "\.php

gt;" AddHandler fcgid-script .php FcgidWrapper "C:/xampp/php/php-cgi.exe" .php </Files>

4: Then add the following lines to your httpd.conf file.

LoadModule fcgid_module modules/mod_fcgid.so

#FCGID Module
Include "conf/extra/httpd-fcgid.conf"

5: Next, comment out the following sections in httpd-xamp.conf file in the following path C:\xampp\apache\conf\extra\httpd-xampp.conf, so that all your PHP files will be served via mod_fcgid.

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

6: Finally, start your apache services and test your web pages.

Verify the installation of PHP-FastCGI

To verify whether FastCGI is enabled in XAMPP, you need to browse the following URL http://localhost/dashboard/phpinfo.php and check whether the value of Server API is CGI/FastCGI as shown in the following picture.

PHP-FastCGI on Windows in XAMPP for PHP Performance

I also tried modifying the setting value for FcgidMaxProcesses as 2 in the http-fcgid.conf file just to verify whether this setting is applied on the apache server. Therefore, it sets maximum number of PHP processing slots as 2. It means that this setting sets a ceiling limit over the top of all users for the maximum number (ie., 2) of FastCGI PHP processes as shown below.

PHP FPM - Check if Installed and Running verify task manager

That’s it. The only problem I see is after stopping apache server from the XAMPP control panel, the FastCGI PHP processes that have been started have to be manually killed via “End Task” option in the Windows Task Manager.

Hope the tutorial on PHP-FastCGI on Windows in XAMPP for PHP Performance helped 🙂

Also See:

References:

Subscribe
Notify of
guest

2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Rehman khan
Rehman khan
2 years ago

How do I enable users for different pools/websites. I actually want security if some website is hacked the hacker should not access other websites on same PC through that website. I heard php-fpm solves this problem? does this can be solved?

gegasoft
2 years ago
Reply to  Rehman khan

i have the same issue that’s why i was in searching of the above article. I want user A to access only his website directory and user B to access his own websites directories. is this possible using fastcgi on windows and defining users for websites?