: This article mainly introduces how to build the PHP + Apache2 development environment in Windows. if you are interested in the PHP Tutorial, refer to it. Build a PHP + Apache2 development environment in Windows
PHP thread security and non-thread security version selection ####
Reference: http://windows.php.net/download/
If you are using PHP as FastCGI with IIS you shoshould use the Non-Thread Safe (ETS) versions of PHP
With Apache you have to use the Thread Safe (TS) versions of PHP.
Conclusion:
+ IIS server: Non-thread-safe PHP version
+ Apache Server: thread-safe PHP version
PHP download
Http://windows.php.net/download/
The personal PC environment is: 2-bit win7, using Apache server.
So download the latest version:
PHP 5.6 (5.6.9) "VC11 x86 Thread Safe (2015-May-14 18:29:57)" compressed package
Apache download
Http://www.apachelounge.com/download/
The latest version is Apache 2.4.12 Win32.
PHP + Apache configuration
Reference: http://php.net/manual/zh/install.windows.apache2.php
Modify the basic configuration information of Apache
Modify the paths of ServerRoot and DocumentRoot in {apache}/conf/httpd. conf:
# Server file path: ServerRoot "c:/bin/Apache24" # Project file path: DocumentRoot "c:/bin/htdocs"
#...
Install using Apache handlerAdd the following information to {apache_path}/conf/httpd. conf:
# Install and run PHPLoadModule php5_module "C:/bin/php5.6/php5apache2_4.dll" in Apache handler mode"
AddHandler application/x-httpd-php. php # configure the php. ini path PHPIniDir "C:/bin/php5.6" # configure the format of the processing file
SetHandler application/x-httpd-php
Install using Apache handlerDownload fast-cgi module: http://www.apachelounge.com/download/win32/
Decompress the package to the modules directory of apche.
Add the following fast-cgi configuration information to {apache_path}/conf/httpd. conf:
# Load the fast-cgi module LoadModule fcgid_module modules/mod_fcgid.so # fast-cgi module configuration
# Where is your php. ini file? FcgidInitialEnv PHPRC "c:/bin/php5.6/" FcgidInitialEnv PATH "C:/bin/php5.6; 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 40 FcgidConnectTimeout 10 FcgidMaxProcesses 1000 running 64 FcgidProcessLifeTime 120 running 10000 running 0 FcgidFixPathinfo 1 # Global Config Example
Options Indexes FollowSymLinks ExecCGI AddHandler fcgid-script. php FcgidWrapper "c:/bin/php5.6/php-cgi.exe". php
Detailed configuration information is provided in README.txt of the fast-cgi.pdf compressed package.
Start Apache serverRun {apache_path}/bin/httpd.exe on the cmd command line.
In phpinfo (), the running mode is determined by the value of "Server API" of phpinfo:
- CGI/FastCGI: Fast-cg mode
- Apache 2.0 Handler: Apache handler mode
If both apache hanlder and fast-cgi are configured in httpd. cnf, the apache handler mode is used.
The above introduces the establishment of the PHP + Apache2 development environment in Windows, including some content, and hope to help friends who are interested in the PHP Tutorial.