Install PHP 5.3.5 + MySQL 5.1.51 + Apache 2.2.17 in win7 Configuration
The PHP version I used is the latest, php5.3.5. You can download the latest version from here. For the installation of MySQL and Apache, we have already illustrated the preceding figure. MySQL 5.1 is configured and installed, apache 2.2 configuration and installation, the following describes their mutual configuration.
First, we will introduce the differences between various PHP versions. The differences between PHP versions are vc6, vc9, thread safe, and non-thread safe. vc6 is legacy Visual Studio 6 compiler, it is compiled using this compiler. vc9 is the Visual Studio 2008 compiler, which is compiled using Microsoft's vs editor. If you are using Apache or other service software, select vc6, if IIS is used, download vc9. Thread safe is thread security, while non-thread safe is non-thread security. It is not recommended that you apply non-thread safe to the production environment. Therefore, you can download the thread safe version. Download the zip package.
Decompress the package you downloaded, decompress it, and rename it to PhP. I put it in the E drive. You can choose the package based on your needs. However, the following configuration process is ongoing, change the path as needed. Copy and open the folder and find PHP. ini-development, renamed as PHP. INI, of course, you can copy a copy of PHP. ini-development for backup to prevent irreparable errors during configuration.
1. First open PHP. ini and find:
; On Windows:
; Extension_dir = "Ext"
To:
; On Windows:
Extension_dir = "E:/PHP/EXT"
Remove the semicolon before extension_dir (note the slash direction) to specify the directory of the PHP extension package to call the corresponding DLL file.
2. Because PHP does not support automatic connection to MySQL by default, You need to enable the corresponding extended library function, such as php_mysql.dll, which is about:
Extension = php_curl.dll // curl, client URL library function library
Extension = php_gd2.dll // GD plotting function module
Extension = php_mbstring.dll // multi-byte function module
Extension = php_mysql.dll // MySQL function module
Extension = php_mysqli.dll // mysqli function module
Extension = php_pdo_mysql.dll // PDO MySQL function module
Extension = php_pdo_odbc.dll // pdo odbc function module
Extension = php_xmlrpc.dll // function library for XML-RPC
Extension = php_xsl.dll // XSL function module
Remove the semicolon (;) before these extension.
3. 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. in the ini configuration file, find:
; Session. save_path = "/tmp"
To:
Session. save_path = "D:/phpsessiontmp"
4. 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. in the ini configuration file, find:
; Upload_tmp_dir =
To:
Upload_tmp_dir = "D:/phpfileuploadtmp"
5. Modify date. timezone. Otherwise, an error will be reported in date when phpinfo is executed:
Warning: phpinfo () [function. phpinfo]…
Find:
; Date. timezone =
To:
Date. timezone = Asia/Shanghai
So far, the PHP environment configuration on Windows 7 is complete, but it is not enough to complete these configurations. We need Apache to support PHP, therefore, you also need to complete the corresponding PHP configuration in the Apache configuration file.
Configure Apache to support PHP:
Find httpd. conf In the conf folder under the Apache installation directory and open:
1. Add the following in # loadmodule vhost_alias_module modules/mod_vhost_alias.so (The Path depends on your own situation ):
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 under the PHP Directory. Because we use apache2.2.17, we certainly need to make php5apache2_2.dll, and then specify the PHP installation directory and the program extension.
2. We should know that the directory for executing the Web main program on the Apache server by default is apache2.2/htdocs. Therefore, when your web main program directory is changed, we need to modify the corresponding Apache configuration, that is:
DocumentRoot "D:/program files/Apache Software Foundation/apache2.2/htdocs"
To:
DocumentRoot "E:/phpweb"
Order:
<Directory "D:/program files/Apache Software Foundation/apache2.2/htdocs">
To:
<Directory "E:/phpweb">
3. Finally, modify the order of the specific index file:
Directoryindex index.html
To:
Directoryindex index. php index.html
4. 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 E:/php web directory and write the file:
<? PHP
Phpinfo ();
?>
Enter 12.0.0.1 in the browser to view the specific PHP configuration page, which means that the PHP environment configuration is complete on window 7.
Verify that PHP can connect to MySQL. You can create the following code in index. php:
<? PHP
$ Connect = mysql_connect ("127.0.0.1", "root", "Your Database Password ");
If (! $ Connect) echo "MySQL connect error! ";
Else echo "connection successful ";
Mysql_close ();
?>
Then input 127.0.0.1 in the browser. If the connection is successful, the PHP connection to MySQL is successful.
This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/jimanyu/archive/2011/01/09/6125771.aspx