Under Windows PHP+APACHE2 Development environment Construction
PHP thread-safe and non-thread-safe Version Selection # # # #
Reference: http://windows.php.net/download/
If you is using PHP as FastCGI with IIS should use the Non-thread Safe (NTS) versions of PHP
With Apache versions of PHP that has the use of the Thread Safe (TS).
Conclusion:
+ IIS server: Non-thread-safe PHP version
+ Apache Server: Thread-safe PHP version
PHP download
http://windows.php.net/download/
Personal PC Environment: 2-bit win7, using Apache server.
So download now 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/
Currently the latest: Apache 2.4.12 Win32
Configuration of the Php+apache
Reference: http://php.net/manual/zh/install.windows.apache2.php
Modify the basic configuration information of Apache
Modify the paths for ServerRoot and DocumentRoot in {apache}/conf/httpd.conf:
#服务器文件路径ServerRoot "c:/bin/Apache24"#项目文件路径DocumentRoot "c:/bin/htdocs"
# ...
以Apache handler方式安装
在{apache_path}/conf/httpd.conf中添加如下信息:
# 以Apache handler方式安装运行PHPLoadModule php5_module "C:/bin/php5.6/php5apache2_4.dll" AddHandler application/x-httpd-php .php # 配置 php.ini 的路径 PHPIniDir "C:/bin/php5.6" # 配置处理文件的格式 SetHandler application/x-httpd-php
以Apache handler方式安装
下载fast-cgi模块:http://www.apachelounge.com/download/win32/
解压到apche的modules目录中。
The
adds configuration information for the following fast-cgi in {apache_path}/conf/httpd.conf:
# load fast-cgi module loadmodule fcgid_module modules/mod_fcgid.so# fast-cgi module Configuration # W Here 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 + FcgidConnectTimeo UT fcgidmaxprocesses fcgidoutputbuffersize-fcgidprocesslifetime-fcgidmaxrequestsperprocess 10000 Fcgidminprocessesperclass 0 fcgidfixpathinfo 1 # Global Config Example Options Indexes followsymlinks execcgi AddHandler fcgid-script. php fcgidwrapper "c:/bin/php5.6/php -cgi.exe ". PHP
下载的fast-cgi模块压缩包中readme.txt有详细的配置信息
启动Apache服务器
在cmd命令行中执行 {apache_path}/bin/httpd.exe 即可
在phpinfo()中,通过phpinfo()的”Server API”的值判断运行模式:
CGI/FastCGI : Fast-cg模式
Apache 2.0 Handler : Apache handler模式
若在httpd.cnf中对apache hanlder和fast-cgi都进行了配置,则使用apache handler模式
以上就介绍了Windows下PHP+Apache2开发环境搭建,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。