1,下载并安装nginx
2,启动nginx并测试nginx正常运行
3,了解PHP版本中VC9、VC6、Thread Safe、Non Thread Safe的区别
VC9 版本是使用 Visual Studio 9(2008) 编译器编译的,如果你的 PHP 是用 IIS 来架设的,那你就选择 VC9 版本。
再来看 PHP 的两种执行方式:ISAPI 和 FastCGI。
ISAPI 执行方式是以 DLL 动态库的形式使用,可以在被用户请求后执行,在处理完一个用户请求后不会马上消失,所以需要进行线程安全检查,这样来提高程序的执行效率,所以如果是以 ISAPI 来执行 PHP,建议选择 Thread Safe 版本;
而 FastCGI 执行方式是以单一线程来执行操作,所以不需要进行线程的安全检查,除去线程安全检查的防护反而可以提高执行效率,所以,如果是以 FastCGI 来执行 PHP,建议选择 Non Thread Safe 版本。
4,下载并安装php
5,创建源文件目录
6,配置并启动nginx
[[email protected] test]# diff nginx.conf nginx.conf.default 44,45c44,45< root G:/webserver/webroot;< index index.html index.htm index.php;---> root html;> index index.html index.htm;65,70c65,71< location ~ \.php$ {< fastcgi_pass 127.0.0.1:9000;< fastcgi_index index.php;< fastcgi_param SCRIPT_FILENAME G:/webserver/webroot$fastcgi_script_name;< include fastcgi_params;< }---> #location ~ \.php$ {> # root html;> # fastcgi_pass 127.0.0.1:9000;> # fastcgi_index index.php;> # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;> # include fastcgi_params;> #}[[email protected] test]#
7,配置并启动php
extension_dir = "G:\webserver\php\ext"extension=php_curl.dll extension=php_gd2.dll extension=php_mbstring.dll extension=php_mysql.dll extension=php_mysqli.dll extension=php_pdo_mysql.dll extension=php_pdo_sqlite.dll extension=php_sockets.dll extension=php_sqlite.dll extension=php_sqlite3.dll extension=php_exif.dll date.timezone = Asia/Chongqing
[[email protected] test]# diff php.ini php.ini.default 211c211< short_open_tag = On---> short_open_tag = Off1860,1874d1859< < extension_dir = "G:\webserver\php\ext"< extension=php_curl.dll < extension=php_gd2.dll < extension=php_mbstring.dll < extension=php_mysql.dll < extension=php_mysqli.dll < extension=php_pdo_mysql.dll < extension=php_pdo_sqlite.dll < extension=php_sockets.dll < extension=php_sqlite.dll < extension=php_sqlite3.dll < extension=php_exif.dll < date.timezone = Asia/Chongqing< [[email protected] test]#
8,测试php开发环境配置成功
<html><head><title>phpinfo</title></head><body bgcolor="white" text="black"><center><h1>Welcome to php</h1></center><?php phpinfo();?></body></html>