Installing PHP FastCGI and Zend OPcache on WampServer

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://localhost/ on your browser. The default WampServer homepage will show the details of Apache server. (Example: Server Software: Apache/2.4.9 (Win64) ).
Download mod_fcgid binaries for windows. Extract the files and copy “mod_fcgid.so” into the apache modules folder. The folder path will be
C:\Wamp\bin\apache\apache2.4.9\modules
if your Apache version is 2.4.9.- 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. (Note for Apache 64-bit: When running over fastcgi, the 32-bit version of PHP works fine with Apache 64-bit and can be used instead of the experimental 64-bit version of PHP). The default PHP installation in WampServer is thread-safe (ts) and will be replaced later. Create a folder (eg:
C:\Wamp\bin\php\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:\Wamp\bin\apache\apache2.4.9\conf\httpd.conf
in a text editor such as Notepad++.Look for these two lines:
Disable mod_php by replacing them with:
Enable mod_fcgid by adding the following line:
Configure mod_fcgid by adding the following lines:
Edit phpmyadmin alias configuration file at
C:\Wamp\alias\phpmyadmin.conf
.Locate the following lines:
Replace them with these lines:
Create a new php configuration file by copying existing file at
C:\Wamp\bin\php\php5.5.12\php.ini
toC:\Wamp\bin\php\php5.5.12-nts\php.ini
. Similarly, open a text editor to edit the new configuration file.Correct the path for extension_dir:
Comment out the XDebug extension if it is not required.
Otherwise, download the nts version of the xdebug extension from http://xdebug.org/download.php and place it in the folder
C:/Wamp/bin/php/php5.5.12-nts/zend_ext/
. Then, change the path for the XDebug extension.
Finally, restart Apache server and PHP should be running in FastCGI mode. Visit http://localhost/?phpinfo=1 and check that ServerAPI is CGI/FastCGI to confirm.
Steps to Enable Zend OPcache
Edit the php configuration file at
C:\Wamp\bin\php\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://localhost/?phpinfo=1 and search for Opcache. If it is found, then you have successfully enabled opcode caching!