How to install and configure WindowsApache2.2.11 and Php5.2.9-1 _ PHP Tutorial

Source: Internet
Author: User
Tags php website
Install and configure WindowsApache2.2.11 and Php5.2.9-1. Because pharmar uses Mcafee antivirus software and requires all programs to be installed in ProgramFiles, these files are stored in D: ProgramFiles for ease of management. When writing protection rules for Mcafee, because pharmar uses Mcafee's anti-virus software and requires all programs to be installed in Program Files, these Files are stored in D: \ Program Files for ease of management. Good luck when Mcafee writes protection rules.
Installation and configuration of Apache

Open the apache official website http://archive.apache.org/dist/httpd/binaries/win32/ or mirror site sites. The same version has two types: no_ssl and openssl. openssl has an ssl security authentication mode while its protocol is HTTPS instead of HTTP, this is the difference between servers with SSL and general web servers. Generally, we can download the no_ssl version.

After downloading the apache installation file, click Install. After three consecutive next times, the server information configuration page is displayed. you must enter the network domain, server domain, and website administrator email address, you can simply fill in the format. After you press Next again, the installation path is selected. the default path is long. pharmar changes the installation path to "D: \ Program Files \ Apache \" and continues the installation, until it is completed.

After the installation is complete, apache is automatically started to test whether apache is successfully started. Enter http: // localhost/or http: // 127.0.0.1/in the address bar of the browser. if "It works. ", congratulations, apache has been successfully installed. at the same time, there is a green apache server running icon in the taskbar in the lower right corner of the computer.

Apache also has a configuration file: httpd: conf, which needs to be configured for php to run. Location: D: \ Program Files \ Apache \ conf directory. Open httpd: conf:
1) search for "DocumentRoot". here is the Directory of the specified home page. The default value is "D: \ Program Files \ Apache \ htdocs". you can use the default directory or define it yourself, for example, "D:/PHP ". Note: Do not add "/" at the end of the Directory.
2. check for the latest directoryindex.html. this is the name of the first page of the document. you can add index. php to the end of index.html. Leave a space between each type.
3) search

Options FollowSymLinks
AllowOverride None
Order deny, allow
Deny from all

To:

Options FollowSymLinks
AllowOverride None
Order deny, allow
Allow from all

If You do not change this page, You may encounter an error such as You don't have permission to access/on this server. especially after You change the default homepage path.

Note: Restart the apache server every time you modify the httpd: conf file. In addition, if the iis server is also running on your win32 system, you must stop the iis server and then start apache. Otherwise, the apache server cannot be started.

Php installation and configuration

First download the windows version from the official php website http://www.php.net/downloads.php, there are two versions: PHP 5.2.9 zip package and PHP 5.2.9 installer, the latest version is 5.3.0, pharmar is 5.2.9 version. PHP 5.2.9 installer is an automatic installation method. although it is relatively automated, it is restricted in many aspects. Therefore, pharmar does not recommend this method. The following describes how to manually install PHP 5.2.9 zip package.

1) decompress the PHP zip package to a directory. we recommend that you use "C:/PHP" and the pharmar version is D: \ Program Files \ Php.
2) convert PHP under the Php Directory (D: \ Program Files \ php. rename the ini-dist file to php. ini, PHP configuration file is it, modify the following places, after modifying the php. copy the ini file to the C: \ WINDOWS \ directory:
Extension_dir = "D: \ Program Files \ Php \ ext", pointing to the path where the "php _ *. dll" file is placed in the php folder. The paths of PHP4 and PHP5 are different here.
Doc_root = "D: \ PHP", pointing to the home page set in apache;
Default_charset = "gb2312", modify the default character set. here, if there is a semicolon ";" in front, remove this semicolon;
Change register_globals = Off to register_globals = On to make the passed global variable valid;
Extension = php_dba.dll if there is a semicolon in front, cancel the semicolon, the same as below;
Extension = php_dbase.dll
Extension = php_gd2.dll GD library is used for drawing verification codes;
Extension = php_mysql.dll is used to connect to the MYSQL database;
3) copy the php5ts. dll file under the PHP directory to the C: \ WINDOWS \ system32 directory.
4) modify the httpd. conf file of Apache. Add the following two lines at the end of the file to install PHP in the module mode to enter Apache:
LoadModule php5_module D:/Program Files/Php/php5apache2_2.dll
AddType application/x-httpd-php. php

Note: the directory path of the first line must be updated to the apache dynamic link library of the current version. for example, if apache2.2.11 and php5.2.9 are used here, the file must be php5apache2_2.dll, not php5apache. dll, php5apache2. dll. The suffix of the second php step.
In php4, you need to add a line of AddType mod_php4.c. in php5, you do not need such a line of AddType mod_php5.c. php5 has been integrated; otherwise, apache cannot be started.

The above completes the configuration process of apache and php, and restarts apache. Create the index. php file in the default directory "D: \ Program Files \ Apache \ htdocs" on the server and write the following code:
Phpinfo ();
?>
Enter http: // 127.0.0.1/or http: // localhost/in the address bar of your browser, and you will see the php version information. So far, php and apache have been successfully installed.

Here is the details: httpd, the configuration file of apache. the directory delimiter in conf is "/", while the PHP configuration file is php. the directory in ini must be a backslash "\". Don't confuse it.

MYSQL installation is simple. Go to the official website http://dev.mysql.com/downloads/mysql/5.0.html to download mysql from the Windows platform. select Windows ZIP/Setup. EXE (x86) to the latest version 5.0.77 and download it. Install mysql directly. after installation, you can enter the configuration wizard to set the mysql database password. Everything is OK.
For mysql installation and configuration, see phpMyAdmin installation and configuration methods and troubleshooting.

Errors encountered during the installation of pharmar:
After installing PHP in Windows, Apache may encounter the LoadModule takes two arguments error. The main reason is the following sentence in httpd. conf:
LoadModule php5_module D: \ Program Files \ PHP \ php5apache2_2.dll
The interpreter regards the space in Program Files as the separator of two parameters, so no space is allowed in the statement. I did not find a solution after searching for a long time on the internet. I finally used the level-1 directory symbol to solve the problem. I changed it to the following:
LoadModule php5_module ../php/php5apache2_2.dll
Because apache is installed in the D: \ Program Files \ Apache \ directory, PHP is installed in D: \ Program Files \ php \, so .. /indicates the D: \ Program Files \ directory. this is the Final Solution. I hope you will always find a way to use your brains during installation and configuration.

Program Files, so these Files are stored in D: \ Program Files for ease of management. Mcafee should write protection rules...

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.