How to configure the php + Apache + mysql environment in win7

Source: Internet
Author: User
How to configure the php environment in win7? php + Apache + mysql is an essential element in the configuration process, the following article introduces how to configure the php + Apache + mysql environment in win7.

How to configure the php environment in win7? php + Apache + mysql is an essential element in the configuration process, the following article introduces how to configure the php + Apache + mysql environment in win7.

The B/S architecture is very popular nowadays, because the B/S architecture has many advantages, such as: users only need to have a browser to use, convenient maintenance and upgrade, cross-platform, and so on. This article describes how to configure the development environment of Windows + Apache + PHP + Mysql.

How to configure the php environment in win7? php + Apache + mysql is an essential element in the configuration process. php is responsible for parsing php code, apache is responsible for the server while mysql is the transit station for data interaction.

So how can we configure php + apache + mysql? Next, let's take a look at the specific method. The software version will change, so we need to renew it on a regular basis.

Step 1:

Php-5.5.10-Win32-VC11-x64.zip:

Httpd-2.4.7-win64-VC11.zip:

Mysql-5.6.16-winx64.zip:

Step 2:

Install apache2.4.7(httpd-2.4.7-win64-vc11.zip)

1. Unzip the downloaded installation package: the httpd-2.4.7-win64-VC11.zip will put it in its own installation directory (My Directory D: \ phpEnv \ Apache24)

2. modify the configuration file http. conf (D: \ phpEnv \ Apache24 \ conf \ http. conf)-open it with notepad.

(1) modify the root path of ServerRoot Apache:

(37 rows) ServerRoot "c:/Apache24" changed to => ServerRoot "D:/phpEnv/Apache24"

(2) Modify ServerName your host name:

If this line is not modified, start apache and prompt Starting httpd: AH00558.

(Line 1) ServerName: 80 remove the previous #. This attribute is required when Apache is started from the command line.

(3) modify the main folder directory accessed by DocumentRoot Apache, which is the location of php and html code files. The default path of Apache is under htdocs (D: \ phpEnv \ Apache24 \ htdocs.pdf, which contains a simple access file index.html. You can modify the path by yourself. Here, I will configure it in my new folder www (D: \ phpEnv \ www.

(Row 3) DocumentRoot "c:/Apache24/htdocs"

Change to =>

DocumentRoot "D: \ phpEnv \ www"

(4) modify the configuration of the entry file: in general, we use index.php?index.html#index.htm as the entry of the web project. Only index.html needs to be added to the access port of apachetings. Of course, the settings of this entry file can be increased or decreased according to your own needs. If the requirements are strict, you can write only one index. php, so the entry in the project can only be index. php

(274 rows)

DirectoryIndex index.html

Change to =>


DirectoryIndex index. php index.htm index.html

(5) set the serverscript directory:

(Row 3) ScriptAlias/cgi-bin/"c:/Apache24/cgi-bin/" changed to => ScriptAlias/cgi-bin/"D: /phpEnv/Apache24/cgi-bin"

(6) (380 rows)


AllowOverride None
Options None
Require all granted

Change to =>


AllowOverride None
Options None
Require all granted

3. Start Apache.

Start --- run, Enter cmd, and open the command prompt. Go to the D: \ phpEnv \ Apache24 \ bin directory and press Enter ,.

If no error is reported, you can test it (keep the command window open ).

Put index.html in the directory of Apache24 \ htdocs.html under the D: \ phpEnv \ www directory. "It works" appears when accessed by a browser. This means that apache has been correctly installed and started. You can also open a simple index.html file.

4. Add Apache to the window Service Startup item and set it to start upon startup.

Close the httpd service first (close the command window)

Open a new command window and go to the D: \ phpEnv \ Apache24 \ bin directory:

The command to add the HTTP service is: httpd.exe-kinstall-n "servicename" servicename is the service name. What I add is: when the httpd.exe-k install-n "Apache24" command is successful, a prompt is displayed. You can view the Apache24 service in the window Service Startup item.

Click Start. If you do not want to set it to boot, you can change the start type to manual.

If you want to uninstall the service, stop the service first. Then, enter httpd.exe-k uninstall-n "Apache24" to uninstall the service.

Of course, you can also start Apache using apachemonitor.exe under D: \ phpEnv \ Apache24 \ bin.

The Apache configuration is complete.

Install php5.5.10(php-5.5.10-win32-vc11-x64.zip)

1. decompress the downloaded php-5.5.10-win32-vc11-x64.zip file to the installation directory (D: \ phpEnv \ php)

2. Copy the php. ini-development file in the directory and change it to php. ini, which is the configuration file of php.

3. Add php support for the Apache service

Open the Apache configuration file http. conf and add

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.