Install Apache + MySQL + PHP in Windows

Source: Internet
Author: User
Tags root access
Windows Install Apache + MySQL + PHP

1. install Apache

A) double-click the file Apach_2.2.8_win32-x86-no_ssl.msi to bring up the welcome interface. Click the next button to go to the license agreement interface.

B) The user must agree to the terms in the interface to continue the installation. Select the I accept the terms in the license agreement radio button, click the next button, as shown in 1, to enter the program description and description interface.

Figure 1

C) After browsing the description and description of the program, click Next To go to the server information page, as shown in figure 2.

Figure 2

D) on the server information page, you must enter the domain name, server name, and administrator email. Enter your domain name (for example, goodwaiter.com) under network domain, and enter your server name (for example, www.goodwaiter.com, that is, the host name and domain name) under server name ), fill in the system administrator's contact email address (for example, yinpeng@xinhuanet.com) under administrator's email address, the above three information is for reference only, the contact email address will be provided to the visitor when the system fails. All three pieces of information can be filled in at will. There are also two radio buttons. If the default one is selected, the server is open to everyone and the server port number is 80. This is a recommended option. The second radio button is that the server is only open to the current user and the server port is 8080. select the first option and click Next to enter the setup type interface, as shown in figure 3.

Figure 3

E) on the Setup Type page, you can select the installation type. Typical is installed by default, and Custom User-Defined installation methods are available. Here you can choose custom installation options and click Next, go to the destination folder page, as shown in figure 4. The "Select installation option" page appears. Click "Apache HTTP Server 2.0.55" and select "this feature, and all subfeatures, will be installed on local hard drive. ", that is," This part and its sub-parts are all installed on the local hard disk ".

Figure 4

F) Click the change button to select the installation path. Set the path to "D: \ apache2.2 \" and click Next. (You have chosen it by yourself. It is generally recommended that you do not install it on the disk where the operating system is located. Otherwise, the Apache configuration file will be cleared after the operating system breaks down .)

G) Go to the File Installation page. This is the last step of Apache installation. After the installation is complete, click Finish to end the installation program.

H) after the installation is complete, the Apache server is automatically enabled. An icon is displayed in the lower-right corner of the desktop. The icon style is displayed when the Apache server is started; the server is not started, and the icon style is.

Click the small icon to view the Enable and disable functions of the server. You can also right-click the small icon and select the open Apache monitor command from the shortcut menu to open the Apache monitoring program.

I) after the server is enabled, test the server. Open a browser window and enter "http: // 127.0.0.1/" or "http: // localhost" in the address bar ", press enter to view the 5 UI (the following UI is displayed in all the tutorials I have read, but I have not seen this UI yet, but I only see two English words it works, but it does not matter ).

Figure 5

2. Install PhP5

After the Apache server is successfully started, install PhP5. Follow these steps to install PhP5:

Unzip the php5installation file php-5.2.6-win32.zip to the corresponding directory, such as c: \ php-5.2.6-Win32, D: \ php-5.2.6-Win32, etc. Put it in the D: \ php-5.2.6-Win32 directory, as shown in directory structure 2.1.

Fig 2.1

② Copy all DLL files in this directory to the windows \ system32 directory of the system disk (Windows 2000 users are in the WINNT \ system32 directory ).

③ Copy the file PHP. ini-Dist to the Windows directory of the system disk and rename it PHP. ini.

④ Open the line "; Extension = php_mysql.dll" and remove the Semicolon ";", so that PHP can support the MySQL database.

⑤ Save and exit. PhP5 installation is complete, but the current Apache server cannot parse the PhP5 file, because some settings are required on the server. For more information about how to configure Apache and PhP5, see Chapter 1.

3. Install MySQL

Open the mysqlinstallation file mysql-4.1.14-win32.zip, decompress the file, and run “setup.exe. The following interface is displayed:

Start the MySQL Installation Wizard and press "Next" to continue

Select the installation type, which has three options: "typical (default)", "complete (complete)", and "Custom (custom)". Select "Custom ", with more options, you can familiarize yourself with the installation process.

Click "Developer components (developer part)" and select "this feature, and all subfeatures, will be installed on local hard drive. ", that is," This part and its sub-parts are all installed on the local hard disk ". The preceding operations include "MySQL Server", "client programs (MYSQL client program)", and "documentation (document)" to ensure that all files are installed. Click "change..." to manually specify the installation directory.

Enter the installation directory "D: \ mysql" and do not place it in the same partition as the operating system. This prevents data from being cleared during system backup and restoration. Press "OK" to continue.

Return to the interface and press "Next" to continue.

Confirm the previous settings. If there is an error, press "back" to return the redo. Click "Install" to start installation.

Installing. Please wait until the following interface appears

This is to ask if you want to register an account for mysql.com or use an existing account to log on to mysql.com. Generally, this is not required. Click "Skip sign-up ", click "Next" to skip this step.

Now that the software has been installed, the above interface appears. Here is a good function. MySQL Configuration Wizard does not need to be configured in a mess like before. INI. Check the "configure the MySQL server now" and click "finish" to finish the software installation and start the MySQL Configuration Wizard.

Start the MySQL Configuration Wizard and press "Next" to continue.

Select the configuration method, "detailed configuration (manual precise configuration)", and "standard configuration". Select "detailed configuration" to familiarize yourself with the configuration process.

Select the server type, "Developer machine (development and testing class, MySQL occupies a small amount of resources)", "server machine (server type, MySQL occupies a large amount of resources) "," dedicated MySQL server machine (dedicated database server, MySQL occupies all available resources) ", you choose according to your own type, generally choose" server machine ", not too little, it will not be full.

Select the general purpose of the MySQL database, "multifunctional database (Universal multi-function type, good)", "transactional database only (server type, dedicated to transaction processing, General) "," non-transactional database only (non-transaction processing type, relatively simple, mainly used for monitoring and recording, the support for MyISAM data types is limited to non-transactional ), I chose it with my own purpose. Here I select "transactional database only" and press "Next" to continue.

Configure InnoDB tablespace to select a bucket for the InnoDB database file. If you modify the bucket, remember the location and select the same place for the reinstallation. Otherwise, the database may be damaged, of course, it is okay to back up the database. We will not detail it here. I have not modified it here. Use the default position and press "Next" to continue.

Select the average MySQL access volume of your website and the number of connections at the same time. For example, "demo-support (DSS)/OLAP (about 20 connections)" and "online transaction processing (OLTP) (about 500) "and" manual setting (manually set, enter a number by yourself) ". Here I select" online transaction processing (OLTP) "and my server, enough. Press "Next" to continue.

Whether to enable the TCP/IP connection and set the port. If the port is not enabled, you can only access the MySQL database on your machine. I enable it here and tick the port number: 3306. Press "Next" to continue

This is very important. It is to set the default MySQL database language encoding. The first is the Spanish encoding, and the second is the multi-byte General utf8 encoding, which is not our general encoding, select the third character here, and then select or fill in "GBK" in the character set. Of course, you can also use "gb2312". The difference is that the GBK font size is large, including all the Chinese characters of gb2312, and added traditional Chinese characters and other messy words-when using MySQL, Run "set names GBK;" before executing the data operation command (just run it once, GBK can be replaced with other values, depending on the settings here), you can use Chinese characters (or other texts) normally, otherwise the Chinese characters cannot be displayed normally. Press "Next" to continue.

Select whether to install MYSQL as a Windows service. You can also specify the service name (service ID name) and add the MySQL bin directory to the Windows Kernel-uusername-ppassword##directory. Then, the complete address of mysql.exe is displayed, it is very convenient), I have checked all of them here, and the service name remains unchanged. Press "Next" to continue.

This step asks if you want to change the default root user (Super Management) password (blank by default). If you want to change the "New Root Password", enter the new password here (if re-installed, you have already set a password. Changing the password may cause errors. leave it blank and remove the check box before "modify Security Settings". After the installation and configuration are complete, change the password separately ), "Confirm (re-enter)" is entered again to prevent errors. "Enable root access from remote machines (whether to allow root users to log on to other machines. If you want security, do not check it. If you want convenience, check it )". Finally, "Create an anonymous account (create an anonymous user, and the anonymous user can connect to the database, and cannot operate data, including queries)" is not checked. The settings are complete, press "Next" to continue.

Confirm that the settings are correct. If any error occurs, press "back" to return for the check. Press execute to make the settings take effect.

After the configuration is complete, press "finish" to end MySQL installation and configuration. Here is a common error, that is, the "Start Service" is not allowed, which usually appears on a server where MySQL was previously installed, to solve this problem, first ensure that the previously installed MySQL server is completely uninstalled. If not, check whether the previous password has been modified as mentioned above; if not, back up the data folder under the MySQL installation directory and delete it. After the installation is complete, delete the data folder generated by the installation and remove the backed up data folder, restart the MySQL service. In this case, you may need to check the database and fix it once to prevent data errors.

4. Configure Apache and PhP5

To use the Apache server to support PHP files, make some settings in the Apache configuration file httpd. conf .. The httpd. conf file is located in the conf directory under the Apache root directory. The main settings are as follows.

♫Find the loadmodule configuration block and add the following information at the end of loadmodule:

Loadmodule php5_module D: \ php-5.2.6-Win32 \ php5apache2_2.dll

Result 4.1 of the added file is displayed.

Fig 4.1

♫Modify the DocumentRoot parameter to modify the root directory of the Apache server master. The location of the original root directory is the apache2.2 \ hotdocs directory. You can specify any location, for example:

DocumentRoot "D:/htdocs /"

There is a behavior <directory "D:/apache2.2/htdocs/"> in the position of the 28 rows below DocumentRoot, Which is changed to <directory "D:/htdocs /". (Note that the parameter values of DocumentRoot must be consistent with those of the parameter values here)

♫Add the PHP extension that you want the Apache server to recognize. The added code is as follows:

Addtype application/x-httpd-php.php

The add location 4.2 is shown in.

♫The default page is displayed. The webpage of apacheis index.html. In other words, when the server does not name the file, first check index.html. If index.html is found, the server will load the file; otherwise, the file list in the directory will be displayed. Add a php development page index. php here. The changed code is as follows:

Directoryindex index.html index. php

(In fact, it is not necessarily true that index.html "can be used, such as" test. php)

♫Modify the Apache port number. The port number of Apache is 80. Modify the value of the selected listen item to modify the port number. For example, if it is changed to 82, the changed code is as follows (usually not changed ):

Listen 82

After the preceding configuration is complete, restart the Apache server.

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.