_php examples of installation and configuration methods for Windows Apache2.2.11 and Php5.2.9-1

Source: Internet
Author: User
Tags file copy install php openssl php website first row win32

Because Pharmar is using McAfee's antivirus software and requires all programs to be installed on program files, these files are placed under D:\Program files for easy management. McAfee writes protection rules in a good use.
The installation and configuration of Apache

Open the official Apache website http://archive.apache.org/dist/httpd/binaries/win32/or mirror site http://apache.mirror.phpchina.com/httpd/ binaries/win32/, download the Apache_2.2.11-win32-x86-no_ssl.msi installation file inside. Among them, there are two types of the same version: No_ssl and OPENSSL,OPENSSL SSL Security authentication mode, its protocol is HTTPS instead of HTTP, this is the server with SSL and general Web server difference. Under normal circumstances, we download the No_ssl version of the OK.

After downloading the Apache installation files, click Install, after 3 consecutive next, will enter the server information configuration interface, request to enter network domain, server domain and webmaster's email address, Ordinary users can simply fill in the form of the line. Press Next again, appear to choose the installation path of the interface, the default path is longer, Pharmar to modify the installation path to: "D:\Program files\apache\", continue to install until completed.

Once installed, Apache starts automatically, and you can test whether Apache started successfully. In the browser address bar enter: http://localhost/or HTTP://127.0.0.1/, if "It works.", then congratulations, Apache has successfully installed and a green Apache server running icon in the taskbar on the lower right corner of the computer.

Apache also has a configuration file: Httpd:conf needs to be configured for PHP to run. Location: D:\Program files\apache\conf directory. Open httpd:conf:
1), Look for "DocumentRoot", here is the directory where the specified home page is placed. The default is: "D:\Program files\apache\htdocs", you can use the default directory, you can also define one, such as: "d:/php." Note: Do not add "/" at the end of the table.
2, look for "DirectoryIndex", here is the default first page file name, you can add index.php in the back of the index.html. Leave a space between each type.
3), find
<directory/>
Options FollowSymLinks
AllowOverride None
Order Deny,allow
Deny from all
</Directory>
Modified to:
<directory/>
Options FollowSymLinks
AllowOverride None
Order Deny,allow
Allow from all
</Directory>
If you do not change here, you may be able to appear in the Don t have permission to access/on this server. Such error prompts, especially after changing the path of the default home page.

Note: After each modification of the httpd:conf file, restart the Apache server. Also, if you are running an IIS server on your Win32 system, stop the IIS server before you start Apache, or the Apache server will not start.

How to install and configure PHP

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 the 5.2.9 version used by 5.3.0,pharmar. PHP 5.2.9 Installer for automatic installation, although more automated, but in many ways limited, so pharmar do not recommend this approach, the following describes the PHP 5.2.9 Zip package Compression Package method under the manual installation.

1, the compression of the PHP package zip to a directory, recommended: "c:/php", Pharmar is D:\Program files\php.
2), the PHP directory (D:\Program files\php) under the Php.ini-dist file renamed to php.ini,php configuration file is it, modify the following several places, modify the php.ini file copy to C:\WINDOWS\ In the catalogue:
Extension_dir= "D:\Program Files\php\ext", point to the path to place the "Php_*.dll" file under the Php folder. The paths of PHP4 and PHP5 are different here.
Doc_root= "D:\PHP", pointing to the front page location of Apache settings;
Default_charset= "gb2312", modify the default character set, here, if preceded by a semicolon ";", remove this semicolon;
Register_globals=off is changed to Register_globals=on, which makes it effective to pass global variables;
Extension=php_dba.dll if preceded by a semicolon, remove the semicolon to the same below;
Extension=php_dbase.dll
Extension=php_gd2.dll GD Library to do drawings, generally used for graphics verification code;
Extension=php_mysql.dll is used to connect MySQL database;
3, copy the Php5ts.dll file in the PHP directory to the C:\WINDOWS\system32 directory.
4), and finally modify the Apache httpd.conf file. Add the following 2 lines to the end of the file, which means that you can install PHP in a modular way into Apache:
LoadModule Php5_module D:/program Files/php/php5apache2_2.dll
AddType application/x-httpd-php. php

Note: The directory path for the first row is to be updated to the current version of the Apache dynamic link library, for example, I am using the apache2.2.11 version and php5.2.9, the file must be Php5apache2_2.dll, not php5apache.dll, Php5apache2.dll and so on. The suffix of the second act PHP footstep.
PHP4 version, you need to add a row of AddType mod_php4.c, and in php5, you do not need such a row AddType mod_php5.c, PHP5 has been integrated, otherwise Apache can not start.

The above completes the Apache and PHP configuration process, restart Apache. In the server's default directory "D:\Program Files\apache\htdocs", create a new file index.php, write the following code:
<?php
Phpinfo ();
?>
Enter HTTP://127.0.0.1/or http://localhost/in the browser's address bar and you will see PHP version information. So far, PHP and Apache have been installed successfully.

Here's a detail: Apache's configuration file httpd.conf in the directory split symbol is "/", and PHP configuration file php.ini in the directory is a backslash "\", do not confuse oh.

The installation of MySQL is simple. To the official website http://dev.mysql.com/downloads/mysql/5.0.html, download MySQL under Windows platform, select the latest version of Windows Zip/setup.exe (x86) is 5.0.77, You can download it. Direct installation, after installation is complete, you can go to the Configuration Wizard, set the MySQL database password. Everything OK.
About MySQL installation and configuration see: phpMyAdmin installation Configuration method and problem solving

Pharmar errors encountered during installation:
After installing PHP under Windows, Apache appears LoadModule takes two arguments error, the main reason is this sentence in httpd.conf:
LoadModule Php5_module D:\Program Files\php\php5apache2_2.dll
The interpreter used the space in program files as a separator for two parameters, so no spaces can appear in the statement. On the internet for a long time also did not find a solution, and finally use a level of directory symbols to solve the problem, changed 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. /on the D:\Program files\ directory, this is finally done, I hope everyone in the installation and configuration in the process of thinking there will always be a way.

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.