PHP environment setup: tutorial on installing and configuring PHP + Apache + Mysql in Windows 7

Source: Internet
Author: User
Tags install php on windows php session
Windows 7 has just been installed in the past two days. some time ago, a friend asked me how to install and build a PHP environment in Windows. so I plan to work hard to manually build a PHP environment step by step, I haven't used the PHP environment to build software for the moment. I just installed Windows 7 in the past two days. some time ago, a friend asked me how to install and build the PHP environment in Windows, so I plan to work hard, manually build the PHP environment step by step, and do not use the PHP environment to build software for the moment. here is a detailed tutorial on installing and configuring the PHP + Apache + Mysql environment in Windows 7, hoping to help PHP beginners.

To build a PHP environment in Windows 7, you must first download the PHP code package and the installation package for Apache and Mysql.

PHP version: php-5.3.2-Win32-VC6-x86, VC9 is specifically customized for IIS, VC6 is provided for other WEB service software, such as Apache. I downloaded a ZIP package,

Mysql version: mysql-essential-5.1.45-win32, MySQL Community Server 5.1.45,

Apache version: httpd-2.2.15-win32-x86-openssl-0.9.8m-r2, openssl indicates with openssl module, use openssl to configure SSL secure links for Apache.

Step 1: install the Apache service in Windows 7.

Apache configuration information

Here, we mainly configure the Network Domain, Server Name, Email address, and port used by the Apache service. The default port is port 80. you can configure it on other ports as needed, you can use the default directory or select the installation directory as needed.

After installing the apache service, enter http: // localhost/in the browser to display It's work! Indicates that the Apache service is successfully installed.

Step 2: install Mysql in Windows 7.

Install Mysql database and select the installation directory

Click Mysql installer to automatically install Mysql. during this period, you can select the installation directory of the Mysql database as needed.

  Note:: After installing the Mysql database, you need to configure the Mysql database before using PHP for connection. how to configure it will be discussed later.

  Step 3: install PHP on Windows 7.

In fact, it is very simple to install PHP in Windows 7, because my PHP code package, as long as you extract the php-5.3.2-Win32-VC6-x86 and rename the folder php, copy it to the C directory to complete the PHP installation.

  Step 4: configure the PHP environment in Windows 7.

The configuration of the PHP environment on Windows 7 is much simpler than that on Windows XP, and does not need to be copied. rename the ini-development configuration file to php. ini configuration file. Perform the following configuration:

1. open the php. ini configuration file and find

; On windows:
; Extension_dir = "ext"


; On windows:
Extension_dir = "C:/php/ext"

Specifies the Directory of the PHP extension package to call the corresponding DLL file.

2. because the default PHP does not support automatic connection to Mysql, you need to enable the corresponding extended library functions, such as php_mysql.dll.

Extension = php_curl.dll
Extension = php_gd2.dll
Extension = php_mbstring.dll
Extension = php_mysql.dll
Extension = php_pdo_mysql.dll
Extension = php_pdo_odbc.dll
Extension = php_xmlrpc.dll

Remove the semicolon (;) before these extension.

3. configure the PHP Session function

When using the session function, we must configure the session file storage directory on the server. Otherwise, the session cannot be used. we need to create a new read/write directory folder on Windows 7, this directory is better independent from the main program directory of the WEB. here I have created the phpsessiontmp directory on the root directory of the D disk, and then in php. in the ini configuration file, find

; Session. save_path = "/tmp"


Session. save_path = "D:/phpsessiontmp"

4. how to compile the PHP file upload function when configuring the PHP file upload function?

Like session, when using the PHP file upload function, we must specify a temporary folder to complete the file upload function. Otherwise, the file upload function will fail, we still need to create a read/write directory folder on Windows 7. here I have created the phpfileuploadtmp directory on the root directory of drive D, and then in php. in the ini configuration file, find

; Upload_tmp_dir =


Upload_tmp_dir = "D:/phpfileuploadtmp"

5. modify date. timezone. Otherwise, an error will be reported in date when phpinfo is executed:

Warning: phpinfo () [function. phpinfo]…

We need

; Date. timezone =


Date. timezone = Asia/Shanghai

You can also click for reference

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: 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.