Apache+php+mysql Environment Configuration under Windows

Source: Internet
Author: User

Note that the current Apache and PHP and MySQL to use 32-bit, the machine is 64-bit is also installed 32 bits. I have installed the 64-bit version before, and there is always a problem. Back to the point:

Required Software:

1.apache: Go to the official website to download, my side uses is Httpd-2.4.12-x86-r2.zip

2.php: Also to the official website to download, my side uses is Php-5.4.40-win32-vc9-x86.zip

3.mysql: Same website download, I use MySQL 5.1 (you can use a higher version)

1.apache:

Only need you to extract to the corresponding directory can be, for example, my side will download the Apache files to C:\Apache24:

The Bin directory has:

ApacheMonitor.exe and Httpd.exe can be used to open and close services. When the service is turned on, if the http://localhost page appears, the Apache installation is successful (port default is 80, port is a problem)

htdocs Directory:

This directory contains our web pages (. html,. php), which can be based on http://localhost/hello.php (for example, there is a hello.php in the directory)

Conf directory:

http.conf is a configuration file, and many things need to be configured in this file (such as Php,mysql), which we will describe in detail below.

2.php:

Also only need you to extract the downloaded files to the appropriate directory, E:\php

PHP directory files are php-ini-development and php.ini-production. Simply rename one to php.ini as the configuration file.

3.mysql:

MySQL needs to be installed, just follow the installation step down, remember to set the root password.

To make Apache support Php,mysql, we need to add something:

1. Add the following text below the module load under Apache's http.conf file:

LoadModule php5_module "E:/php/php5apache2_4.dll" (you can unzip the appropriate directory of PHP)
AddType application/x-httpd-php. php. phtml
Phpinidir "e:/php/"

2. Under the php.ini file, modify:

Extension=php_mysql.dll

Extension=php_mysqli.dll

(approximately 880 rows or so)

3. Write a PHP page, placed in the Apache Htdocs directory, named hello.php:

<? PHP $link mysql_connect (' 127.0.0.1 ', ' root ', ' 123456 ', ' Gjs '); if (! $link ) {    diemysql_error());} Echo ' Connected successfully '; Mysql_close ($link);? >

If there are errors you can view: Log files under C:\Apache24\logs:

For example, MySQL connection is not on:

Call to undefined function mysql_connect () in c:\\apache24\\htdocs\\hello.php on line 7

Is that PHP does not load good MySQL accessories, you check the previous said, there is no removal, and the file configuration is correct, It is possible to find the file php.ini path and so on (in the system environment variable path inside add PHP decompression path), to ensure that the installation is 32-bit, basically can, there is a problem can contact me.

Apache+php+mysql Environment Configuration under Windows

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.