Apache2 + Php5 + MySQL5Windows Configuration

Source: Internet
Author: User
First, setupApache2 + Php5 First, install and configure APACHE (in my case, install it to E: ProgramFilesApacheSoftwareFoundationApache2.2) 1. Install it by default, NetworkDomain, ServerName I enter my computer name, enter your email address in the "AdministratorsEmailAddress" area.

First, set up Apache2 + Php5 First. install and configure APACHE (for example, install Apache to E: \ Program Files \ APACHE Software Foundation \ Apache2.2). 1. install Apache by default during installation, network Domain, Server Name I fill in my computer Name, Administrator's Email Address area fill in your Email Address

First, set up Apache2 + Php5

1. install and configure APACHE (for example, install Apache on E: \ Program Files \ APACHE Software Foundation \ Apache2.2)
1. It is installed by default during installation. For Network Domain and Server Name, enter my computer Name and your Email Address in the Administrator's Email Address area.
2. After installation, there will be a conf folder in the installation directory. Open the httpd. conf file for configuration.
· Find DocumentRoot and set it to the folder where you want to store php, htm, and other web Files, such as "E: \ Program Files \ Apache Software Foundation \ Apache2.2 \ htdocs ";
· Find the DirectoryIndex, add index. php and index.htm after index.html, and separate it with a single space;
· Restart Apache and Use http: // localhost or http: // 127.0.0.1 or http: // yourcompanyname to test whether Apache is successful. If It succeeds, there will be an It works on the screen!
2. install and configure PHP (decompress the PHP compressed package to d: \ php \)
1. Set php. rename the ini-recommended file to php. ini and cut it to the system directory (for example, in the Windows/system32 directory of 2000/NT, WINNT/system32 directory of XP ),
2. Change extension_dir to the directory where php/ext is located, for example, "d: \ php \ ext ";
3. Change doc_root to the same directory in step 1, for example, "E: \ Program Files \ Apache Software Foundation \ Apache2.2 \ htdocs ";
4. Find; session. save_path = "/tmp", remove ';' and set the directory where you saved the session, such as session. save_path = "D:/php/session_temp ";
5. Remove the semicolon in the following sentence to better support Mysql and PHPmyadmin.
Extension = php_mbstring.dll
Extension = php_gd2.dll
Extension = php_mysql.dll
Third, PHP + APACHE
1. Apache is allowed to run PHP programs as modules:
Open httpd. conf and add the following content (any location ):
LoadModule php5_module "d:/php/php5apache2_2.dll" (special feature). In many cases, php5apache2.dllis used. In this case, an error occurs when the php code is run)
AddType application/x-httpd-php. php
AddType application/x-httpd-php. htm
(.Htm,. php can be used as the extension of the executable php language, and html, php3, php4, or even txt can be added)
(The following two steps are not required)
2. If you run the PHP program (use php.exe) in the cgimodel for a specific reason ),
Change the above line to a comment (add # To each line header) and add the following lines:
# ScriptAlias/php/"d:/php /"
# AddType application/x-httpd-php. php
# Action application/x-httpd-php "/php/php-cgi.exe"
3. Now apache 2 supports HTML but does not support PHP. Add the following sentence to d: \ apache2 \ conf \ httpd. conf:
# ScriptAlias/php/"d:/php /"
# AddType application/x-httpd-php. php
# Action application/x-httpd-php "/php/php-cgi.exe"

4. Restart the service
1. Find php5ts in d: \ PHP. dll, libmysql. dll copies it to c: \ winnt \ system32 (winNT/2000), while winXP/2003 copies it to c: \ windows \ system32
2. test whether the connection between Apache and php is successful:
Start the start apache service or restart the restart apache
3. Create test. php under the Web root directory (E: \ Program Files \ Apache Software Foundation \ Apache2.2 \ htdocs)

Test

Phpinfo ();
?>

4. Run http: // localhost/test. php
If it succeeds, you should see a webpage containing the PHP logo, which contains a lot of settings and other information.
Congratulations!

Note:
If it cannot run, it cannot be started after PHP5.1. * + apache 2.2.2 is installed using the traditional modular method,

Tip:
"Cannot load D:/php/php5apache2. dll into server: The specified module cocould not be found ."

Cause:

The php5apache2. dll in the PHP compressed package is only applicable to apache2.0.*. Do you want to change php5apache2. dll to php5apache2_2.dll, which is the 1st small step in step 3?
Other solutions:

Download (http://www.phpv.net/php5apache2.dll-php5.1.x.rar) and unzip. There are three files.

Vcredist_x86.exe
Php5apache2. dll
Httpd.exe. manifest
1. Overwrite php5apache2. dll to the php5apache2. dll file in your original PHP Directory.
2. Copy the httpd.exe. manifest file to the bin folder under your apache installation directory.
3.install vcredist_x86.exe in double-hitting mode.
Done! Restart apache.

Second, set up MySQL5

After installing MySql, find the php. ini file in the Php5 installation directory.

In addition to removing the semicolon in php. ini, you should also change extension_dir to the directory where php/ext is located.

Finally, do not forget to copy it to the windows directory.


The permission to read and run the mysql directory under drive C must also be added to the permissions of users, including listing folder directories and reading.

Restart the apache service and press F5 in the browser to refresh it.

Last, I succeed, if you have any trouble, please google.

If you want to debug php application, just set up vs. php for visual studio 2008

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.