PHP learning notes: install and configure the php environment under IIS7. For more information, see how to install Php.
Php version selection
Php in windows (php5.4.7) has two versions:
VC9 x86 Non Thread Safe Non-Thread security model run in FastCGI mode
VC9 x86 Thread Safe Thread security runs in ISAPI mode
Installation process
You only need to extract the zip package from the previous step, and then configure php. ini. for details, see how to configure Php.
How to install Mysql
Download the Mysql database msi installation file. the installation prompt is "next.
How to configure Php
Decompress the zip package of Php, find the php. ini-production file in the root directory, and rename the file php. ini.
Open the php. ini configuration file,
Set
; On windows:
; Extension_dir = "ext"
Change
; On windows:
Extension_dir = "C:/php/ext"
Specifies the Directory of the PHP extension package to call the corresponding DLL file.
Because PHP does not support automatic connection to Mysql by default, you need to enable the corresponding extended library functions, such as php_mysql.dll.
Extension = php_curl.dll
Extension = php_gd2.dll
Extension = php_mbstring.dll
Extension = php_mysql.dll
Extension = php_pdo_mysql.dll
Extension = php_pdo_odbc.dll
Extension = php_xmlrpc.dll
Note: extension = php_mysql.dll may be used by default before it is changed; extension = msql. dll will prompt that the mysql module does not support it if it is not changed.
Remove the semicolon (;) before the extension.
Configure the PHP Session function
When using the session function, we must configure the session file storage directory on the server. Otherwise, the session cannot be used. we need to create a new read/write directory folder on Windows 7, this directory is better independent from the main program directory of the WEB. here I have created the phpsessiontmp directory on the root directory of the D disk, and then in php. ini configuration file
Set
; Session. save_path = "/tmp"
Change
Session. save_path = "D:/phpsessiontmp"
Configure the PHP file upload function?
Like session, when using the PHP file upload function, we must specify a temporary folder to complete the file upload function. Otherwise, the file upload function will fail, we still need to create a read/write directory folder on Windows 7. here I have created the phpfileuploadtmp directory on the root directory of drive D, and then in php. ini configuration file
Set
; Upload_tmp_dir =
Change
Upload_tmp_dir = "D:/phpfileuploadtmp"
Modify date. timezone. Otherwise, an error will be reported in the date section when phpinfo is executed:
Set
; Date. timezone =
Change
Date. timezone = Asia/Shanghai; Shanghai
Date. timezone = Asia/Urumqi; Urumqi, Beijing
Check whether php configuration is successful
You can only double-click php.exe in the PHP installation directory. if there is a problem, you can see the system prompts on the cmd interface.
Install FastCgi (window server 2008 R2) in IIS7)
1) open the Control Panel and click [open or close windows function]
2) on the "role" node, select "Add role Service ].
3) Check [CGI] under "application development" and click install. Then restart IIS.
Deploy a php Site
1) create a site under IIS.
2) select this website and open "handler ing]
3) Click add module ING]
4) configure the request path to *. php.
Module selection: FastCgiModule
Executable file: Select php-cgi.exe from the PHP decompressed file.
Visit the website.