1. php version Overview
Differences between different php versions. The difference between VC6 and VC9, Thread Safe and Non-Thread Safe is generally found after php versions. VC6 is legacy Visual Studio 6 compiler, just
It is compiled using this compiler. VC9 is the Visual Studio 2008 compiler, which is compiled using Microsoft's VS editor. If you choose Apache or other service software
If you select VC6 and IIS, download VC9. Thread Safe is Thread security, while Non-Thread Safe is Non-Thread security.
Non Thread Safe is used in the production environment, so you can download the Thread Safe version. Download the Zip package.
2. php download, select which version
Http://windows.php.net/download/, the pen selects php-5.3.16-win32-vc9-x86.zip
(1) If you are using apache1 or apache2, select php of vc6.
(2) If IIS is used, you should select PHP of VC9.
VC6 is compiled with Visual Studio 6 and VC9 is compiled with Visual Studio 2008, which improves performance and stability. Microsoft 2008 C ++ must be installed in VC9.
Runtime, http://www.microsoft.com/en-us/download/details.aspx? Id = 29, or install VC10,
Http://www.microsoft.com/download/en/details.aspx? Id = 8328
3. Download and install apache
(1) Renew
(2) apache installation:
Configuration
Network Domain: yourdomain.com
Server Name: www.yourdomain.com
Email: username@126.com
The default port used by the Apache service is port 80. You can configure other ports as needed. You can use the default directory for Apache installation or select the installation directory as needed.
After installing the apache service, enter http: // localhost/in the browser to display It's work! Indicates that the Apache service is successfully installed.
(3) If "(OS 10013)" is reported when apache is started, an attempt to access the socket is made in a way that the access permission is not allowed. : Make_sock: cocould not bind
Address 0.0.0.0: 80 "error.
Use netstat-ano to check whether port 80 is occupied. Generally, port 80 is occupied by IIS.
(4) solution: Open the Apache installation directory \ conf \ httpd. conf file and modify listen 80 -- "listent 88
(5) Enter http: // localhost: 88 in the browser.
(6th if an error occurs during startup of apachewhen httpd.exe: cocould not reliably determine the server's fully qualified domain name, using 192.168.1.111
For ServerName "is because DNS is not configured properly. If you do not want to configure DNS, remove the # Before ServerName in httpd. conf and change it to ServerName 127.0.0.1: 88.
4. install and configure php
(12-decompress php-5.3.16-win32-vc9-x86.zip to d: \ php
(2) Rename the php. ini-development configuration file to php. ini.
(3) Open the php. ini file and find the following text:
; On windows:
; Extension_dir = "ext"
Remove ";" before extension_dir and change it to extension_dir = "D:/php/ext" to specify the directory of the PHP extension package to call the corresponding DLL file.
(4) because the default PHP does not support automatic connection to Mysql, You need to enable the corresponding extended library function, such as php_mysql.dll. Find the following dll text and remove the preceding ";"
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_odbc.dll
Extension = php_xmlrpc.dll
(5) 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 object on Windows 7.
Directory. It is recommended that this directory be 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 found it in the php. ini configuration file.
; Session. save_path = "/tmp"
Change
Session. save_path = "D:/phpsessiontmp"
(6) 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 and we still need
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 find it in the php. ini configuration file
; Upload_tmp_dir =
Change
Upload_tmp_dir = "D:/phpfileuploadtmp"
The default size of the php file to be uploaded is 2 MB,
Upload_max_filesize = 2 M. You can change it
Upload_max_filesize = 8 M
(7) Time Zone settings
Modify date. timezone. Otherwise, the error "Warning: phpinfo () [function. phpinfo]…" will be reported when phpinfo is executed. In the php. ini configuration file, find
; Date. timezone =
Change
Date. timezone = Asia/Shanghai
5. Configure Apache to support PHP, so you need to complete the corresponding PHP configuration in the Apache configuration file.
(1) Open d:/apache/modules/mod_vhost_alias.so
Add
LoadModule php5_module "c:/php/php5apache2_2.dll"
PHPIniDir "c:/php"
AddType application/x-httpd-php. php. html. htm
We can see multiple php5apache DLL files in the PHP Directory. Because we use Apache2.2.15, we certainly need to use php5apache2_2.dll and then specify
PHP installation directory and program extension.
(2) Enable httpd. conf of apache again to modify DocumentRoot.
DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"
Change
DocumentRoot "D:/PHPWeb"
(3) modify Directory
<Directory "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs">
Change
<Directory "D:/PHPWeb">
(4) modify the order of the specific index file. Because the PHP function is configured, index. php must be executed first.
DirectoryIndex index.html
Change
DirectoryIndex index. php index.html
(5) Enable rewrite module
# LoadModule rewrite_module modules/mod_rewrite.so remove the front #,
Change to LoadModule rewrite_module modules/mod_rewrite.so
6. Restart the Apache server.
Now, the PHP environment configuration on the Apache server is complete. You only need to create a new PHP file in the D:/PHP web directory and write
Copy codeThe Code is as follows:
<? Php
Phpinfo ();
?>
Enter http: // localhost: 88 in the browser to view the specific PHP configuration page, which means that the PHP environment configuration is complete on Window 7.
7. Test Database Connection
Create testdb. php
Copy codeThe Code is as follows:
<? Php
$ Connect = mysql_connect ("127.0.0.1", "root ","**");
If (! $ Connect)
Echo "Mysql Connect Error! ";
Else
Echo "db connect hello ";
Mysql_close ();
?>
If Chinese characters are garbled, modify php. ini to configure default_charset = "UTF-8"
8. If your above configuration is too complex, you can use wamp dummies package, http://www.wampserver.com
Because WAMPSERVER (32 BITS & PHP 5.3) 2.2E contains
Apache 2.2.22-Mysql 5.5.24-PHP 5.3.13 XDebug 2.1.2 XDC 1.5 PhpMyadmin 3.4.10.1 SQLBuddy 1.3.3 webGrind 1.0
The author on his computer wamp found that although the PhpMyadmin database and table settings in the UTF-8 or garbled, the solution is to add after mysql_connect ()
Copy codeThe Code is as follows:
Mysql_query ("set names utf8 ");
Chinese Garbled text