There are still many solutions to this problem on the network, but most of them require Copy Some files Windows Or System32 The directory is not elegant enough. I have referenced PHP User Manual and MySQL To find a solution that does not need to copy files.
The preparation steps are as follows:
1. Set PH P 5.1.4 Decompress the package D: \ PHP , Copy PHP. ini-recommended Is PHP. ini
2. Install Apache 2.0.59
3. Install Mysql5
4. Backup" Apache Group \ apache2 \ conf "Folder
5. Slave MySQL Download website MySQL connector/PHP File, download MySQL extension (pH P 5.1.4 ) For MySQL Server 5.0.22 The package.
The following describes how to configure.
Modify Apache Of Httpd. conf File
1. Add phpinidir variable; set loading PhP5 module path; set . php file type processing method. The Code is as follows:
# PHP config
Loadmodule php5_module "D:/PHP/php5apache2. dll"
Addtype application/X-httpd-PHP. php
Phpinidir "D:/PHP /"
2.Set Index. php Join Directoryindex Variable. The Code is as follows:
Directoryindex index.html. var index. php
Update MySQL connector/PHP
Extract MySQL connector/PHP Compressed package D: \ PHP , And Php_mysql.dll Copy D: \ PHP \ ext
Modify PHP. ini
1.Modify Include_path = ".; D: \ PHP \ Pear"
2. modify extension_dir =" D: \ PHP \ Ext "
3. cancel extension = php_mysql.dll semicolon
4.Cancel Extension = php_gd2.dll Semicolon
The configuration is completed here. To test the effect, you can Apache Group \ apache2 \ htdocs Create a folder named Phpinfo. php File, the content is as follows:
<? PHP
$ Link = mysql_connect ('localhost', 'test', 'test ');// User and password , Please change it based on your own situation
If (! $ Link) echo "fail ";
Else echo "success ";
Mysql_close ();
Echo phpinfo ();
?>
then access HTTP: // localhost/phpinfo. php If the top of the page is printed success , the setting is successful. Otherwise, you can use phpinfo check the problem.