Apache+php+mysql installation Configuration Method Summary _php Skill

Source: Internet
Author: User
The entire installation process is as follows:

1, first install Apache: I installed the version is: Httpd-2.2.16-win32-x86-openssl-0.9.8o.msi
URL: http://www.apache.org/dist/httpd/binaries/win32/
Apache installation and configuration is relatively smooth, there is nothing to say.
Ways to change file paths:
In the file installation directory, my is: D:\Program files\apache Software foundation\apache2.2\conf, open httpd.conf Search: DocumentRoot "c:/web/ Apache/htdocs "Change the value to the publishing path you want, such as:
DocumentRoot "D:/www"
Then there's one more place to change.
Search: Directory "C:/web/apache/htdocs"
Modified to: Directory "D:/www"
This changes the publication path of the file to D:www.

2, install PHP: version: Php-5.3.3-win32-vc6-x86

URL: http://windows.php.net/download/
Extract the downloaded compressed package to d:php and rename the php.ini-development in the directory to php.ini
Open the php.ini and modify the following:
Search: error_reporting = E_all
Modified: error_reporting =e_all & ~e_notice
This is to modify the error reporting level, E_all is to report all errors, E_notice is the message that the report runtime notices, such as variables for initialization.
Search: Extension_dir = "./"
Modify: Extension_dir = "D:\php5\ext" To configure the path to the extension library
Search:; extension=php_mysql.dll, remove the preceding semicolon: Extension=php_mysql.dll
Search:; extension=php_mysqli.dll remove the preceding semicolon: Extension=php_mysqli.dll
Search Session.save_path = "/tmp", modified to a path in existence, Session.save_path = "d:/mysql/session", or create a TMP folder under the publishing directory.
PHP Basic Setup Complete

3, configure Apache load PHP

Open the Apachede installation directory, my is: D:\Program files\apache Software Foundation\apache2.2\conf\extra, create a new text file named: httpd-php5.conf, Open Add the following content
View Sourceprint? LoadModule php5_module "C:\web\php\php5apache2_2.dll"
AddType application/x-httpd-php. php
AddType Application/x-httpd-php-source. Phps
DirectoryIndex index.php
Phpinidir "C:\web\php"
Then open: C:\web\apache\conf\httpd.conf, add a row at the end of the file:
Include conf/extra/httpd-php5.conf
Restart Apache, Open Directory: D:\WWW, new file: index.php, enter:
<?php
Phpinfo ();
?>
Use the browser to open http://localhost to test whether the installation was successful
Fourth step: Install MySQL: Version mysql-5.1.49-win32
URL: http://dev.mysql.com/downloads/mysql/#downloads
After installation, there is a configuration wizard, not very strict according to which option to set, according to their own needs to set on the line, the impact is not big.
With Apache and PHP combined, mentioned earlier, here again, in the PHP installation directory to find PHP.ini, put "; Extension=php_mysql.dll" before ";" Remove and load the MySQL module. Save, shut down, restart Apache on it.
Fifth Step: Install phpMyAdmin
I am in the Chinese military software download: http://www.onlinedown.net/soft/2616.htm
Decompression is placed in the publish directory, is the previous set of D:\WWW; change the config.default.php under the \libraries folder
Make the following modifications:
1 Find password like the next two lines
$cfg [' Servers '] [$i] [' user '] = ' root ';
$cfg [' Servers '] [$i] [' password '] = ';
Fill in your MySQL password to $cfg[' Servers ' [$i] [' password '] = '; Single quotes Inside
2 Search $cfg [' Pmaabsoluteuri '], set it to phpMyAdmin directory path, such as: http://localhost/phpMyAdmin/
The above practice does not know is not necessary, because I later changed back to also can run.

Summary of issues encountered during configuration:
One, install MySQL failed.
The general situation is that the previous MySQL uninstall is not complete. How to be clean enough to uninstall MySQL? In a DOS environment
1, stop the MySQL service first: Stop mysql:net stops MySQL, you can also right-click "My Computer"--management-service-find the MySQL service, and then stop.
2, uninstall C:\mysql\bin\mysqld-nt--remove under DOS
C:\mysql\bin\ is the specific path, want to completely remove MySQL, first end the MySQL process, and then uninstall MySQL.
An additional two DOS instructions are:
Starting mysql:net start MySQL
Installation: C:\mysql\bin\mysqld--install//Note Modify specific path
3, delete the remaining MySQL files directly.
If you accidentally delete all of the MySQL files, and did not perform the above uninstall function, you can use the following methods:
1, stop MySQL service, ditto 1.
2, manually delete registry information:
Clear your MySQL service in the registry (regedit). There are several places: Hkey_local_machine\system\controlset001\services\eventlog\application\mysql directory deletion; Hkey_local_machine\system\controlset002\services\eventlog\application\mysql directory deletion; Hkey_local_machine\system\currentcontrolset\services\eventlog\application\mysql directory deletion;
As shown in figure:

Reboot can be.

Two, there was a problem connecting to the database:

"Because the connecting party did not respond properly after a period of time or the host that was connected was not responding", I was testing the MySQL connection when I appeared
<?php header ("content-type:text/html; Charset=utf-8 "); $link =mysql_connect ("localhost", root,605959); if (! $link) echo "Failed!"; else echo "Success!"; Mysql_close (); ?>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

The reason is MySQL parsing error, because the Hosts file is not defined, the localhost replaced by 127.0.0.1 on the display of normal, or under C:\WINDOWS\SYSTEM32\DRIVERS\ETC, modify the Hosts file, Add 127.0.0.1 localhost.
PHP Configuration Environment (standard configuration) Word version

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.