Manual installation of Apache+php+mysql and environment configuration

Source: Internet
Author: User
Tags win32

Prepare the software first:

Apache official: Apache_2.0.55-win32-x86-no_ssl.msi, more versions here;

PHP Official: Php-5.0.5-win32.zip, more images, more version download;

MySQL official: mysql-4.1.14-win32.zip, more images, more versions to download.

First, the installation and preparation of Apache.

1) Install Apache:

If you have IIS installed on the machine, first let the 80 port out (ie stop the website) and then start installing Apache, run the downloaded Apache software, and customize the installation.

Start IE, soft input "http://localhost/" in the browser, or enter "http://127.0.0.1"

If you can see the "It works!" Prompt, indicating that the installation was successful.

If you want to run IIS and Apache at the same time, you can modify the port of IIS or modify the Apache port (configuration file: http.conf).

2) Preparing Apache:

In fact, if you do not configure, the Apache2/htdocs folder in your installation directory is the default root directory of the site, you can put files in it.

Now start configuring the Apache server so that it serves us better,

1) Find "DocumentRoot" (that is, the Web site root directory)

Change the default value of DocumentRoot to the root of your site, such as "D:/iphppub/www" (Note: The file address of "/" in Apache to change to "/")

2) Find <directory "***/apache2.2/htdocs" > "

Change "***/apache2.2/htdocs" to the root of your site, to the same value as DocumentRoot.

3) Find DirectoryIndex, add a default home page (that is, the directory index, that is, in the case of only the specified directory, the default display of the file name), you can add a lot, system

is prioritized from left to right, separated by a single, half-width space. The homepage of the website is index.php, then add "index.php".

Second, the installation and preparation of PHP.

1) Extract the downloaded Php-5.2.3-win32.zip to the specified directory, assuming: d:/php523.

2) now start to combine PHP with Apache in module mode, so that PHP into Apache, open Apache configuration file,

Add the following two lines

The first line of "LoadModule php5_module D:/php523/php5apache2_2.dll" refers to loading PHP in module mode,

The second line "Phpinidir" d:/php523 "is the location of the PHP configuration file php.ini, of course, where the" d:/php "to

Change to the directory of the PHP decompression you selected earlier.

3) Add "AddType application/x-httpd-php. php", "AddType application/x-httpd-php. html" two lines,

You can also add more, essentially adding a file type that can execute PHP,

For example, if you add a line of "AddType application/x-httpd-php. htm", the. htm file can also execute the PHP program,

You can even add the previous line, "AddType application/x-httpd-php. txt", so that the text file format can also run PHP.

★ Test the PHP configuration is successful, open Notepad, enter the following code
<?php
Phpinfo ()
?>


Save the code to version.php and then stop the Apache server before booting. Copy the version.php to the "d:/iphppub/www" directory,

Then enter "http://localhost/version.php" in IE
If configured correctly, you can see most of the system configuration information

Third, the installation of MySQL, with PHP,Apache combined

1) Open the downloaded MySQL installation file mysql-4.1.14-win32.zip, double-click Unzip, run the installation.

2) Successful installation, start with Apache and PHP combined, in the PHP installation directory to find php.ini-recommended and name it php.ini,

Open php.ini "; Extension=php_mysql.dll" before ";" Remove and load the MySQL module. Save, shut down, restart Apache on the go.

It is also possible to select other modules to load, remove the ";" from the front, which means that the module is loaded, the more loaded, the more resources it takes, but

There is no more to go. All module files are placed under "ext" in the PHP decompression directory.

3) Search Extension_dir = "./" line and point its path to the extensions directory in your PHP directory,

For example: Extension_dir = "D:/php523/ext"

4) Libmysql.dll to the System files under Windows folder.

▲ Launch PHP support module for MySQL, look for "Extension=php_mysql.dll" string in the php.ini file, remove the former semicolon

The following is a simple code to test the MySQL installation, configuration (note: Restart Apache service)
<?php
$link =mysql_connect (' localhost ', ' root ', ' 123456 ');
if (! $link) echo "failed";
else echo "Success";
Mysql_close ();
?>

Manual installation of Apache+php+mysql and environment configuration

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.