Installing PHP FastCGI and Zend OPcache on XAMPP for Windows

Why install PHP + FastCGI?
Mod-PHP comes installed with WampServer, and it is slow.
You also cannot utilise the Zend opcode cache, which is included with PHP itself since PHP 5.5.
Steps to install PHP + FastCGI
Identify the version of Apache server that is running. Tips: visit http://127.0.0.1/xampp/phpinfo.php on your browser. Search for the
SERVER_SOFTWARE
environment variable, which will indicate Apache version. (Example: Apache/2.4.4 (Win32) OpenSSL/1.0.1g PHP/5.4.16 ).Download mod_fcgid binaries for windows. Extract the files and copy “mod_fcgid.so” into the apache modules folder. The default folder path will be
C:\xampp\apache\modules
.- Apache 2.4-VC11 (64-bit): http://www.apachelounge.com/download/VC11/modules/modules-2.4-win64-VC11.zip
- Apache 2.4-VC11 (32-bit): http://www.apachelounge.com/download/VC11/modules/modules-2.4-win32-VC11.zip
- Apache 2.4-VC10 (64-bit): http://www.apachelounge.com/download/win64/modules-2.4/mod_fcgid-2.3.9-win64.zip
- Apache 2.4-VC10 (32-bit): http://www.apachelounge.com/download/win32/modules-2.4/mod_fcgid-2.3.9-win32.zip
- Apache 2.2-VC10 (64-bit): http://www.apachelounge.com/download/win64/modules-2.2/mod_fcgid-2.3.9-win64.zip
- Apache 2.2-VC10 (32-bit): http://www.apachelounge.com/download/win32/modules-2.2/mod_fcgid-2.3.9-win32.zip
Download the latest PHP binaries for windows. (Link: http://windows.php.net/download/). Choose the non-thread-safe (nts) version for fastcgi usage. The default PHP installation in XAMPP is thread-safe (ts) and will be replaced later. Create a folder (eg:
C:\Xampp\php5.5.12-nts
) for your new php installation. Extract and copy all the files into the folder.Edit the Apache configuration file. Open the file
C:\Xampp\apache\conf\extra\httpd-xampp.conf
in a text editor such as Notepad++.Look for the section PHP-Module setup. Disable mod_php by commenting out them as below:
Enable mod_fcgid by adding the following lines after the section:
Create a new php configuration file by copying the file at
C:\Xampp\php5.5.12-nts\php.ini-development
toC:\Xampp\php5.5.12-nts\php.ini
.Finally, restart Apache server and PHP should be running in FastCGI mode. Visit http://127.0.0.1/xampp/phpinfo.php and check that ServerAPI is CGI/FastCGI to confirm.
Steps to Enable Zend OPcache
Edit the php configuration file at
C:\Xampp\php5.5.12-nts\php.ini
.Locate the section [opcache].
Add this line before the section:
Uncomment the configuration lines in the section:
Finally, restart Apache web server. Visit http://127.0.0.1/xampp/phpinfo.php and search for Opcache. If it is found, then you have successfully enabled opcode caching!
comments powered by Disqus