Apache2 + PhP5 + mysql5 windows Configuration

Source: Internet
Author: User

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 Program Run as a module:
Open httpd. conf and add the following content (any location ):
Loadmodule php5_module "D:/PHP/php5apache2_2.dll" Code The httpd.exe application is incorrect)
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)
<HTML>
<Head> <title> test </title> <Body>
<? PHP
Phpinfo ();
?>
</Body>
</Html>

4. RunHttp: // 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 decompress the package. There are three files in total.

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

Related Article

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.