Home > Backend Development > PHP Tutorial > Installation and configuration method of Windows Apache2.2.11 and Php5.2.9-1_PHP tutorial

Installation and configuration method of Windows Apache2.2.11 and Php5.2.9-1_PHP tutorial

WBOY
Release: 2016-07-21 15:46:10
Original
794 people have browsed it

Because pharmar uses Mcafee’s anti-virus software, all programs are required to be installed in Program Files, so these files are placed under D:Program Files for easy management. Mcafee is easy to use when writing protection rules.
Apache installation and configuration

Open apache official website http://archive.apache.org/dist/httpd/binaries/win32/ or mirror website 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 has an additional SSL security authentication mode. Its protocol is HTTPS instead of HTTP. This is the difference between a server with SSL and a general web server. Under normal circumstances, it will be ok if we download the no_ssl version.

After downloading the apache installation file, click Install. After three consecutive times of next, you will enter the server information configuration interface, which requires you to enter the network domain, server domain and website administrator’s email address. Ordinary users can follow Just fill in the format. After pressing Next again, an interface for selecting the installation path appears. The default path is relatively long. Pharmar changes the installation path to: "D:Program FilesApache" and continues the installation until it is completed.

After the installation is completed, apache will start automatically. You can test whether apache starts successfully. Enter: http://localhost/ or http://127.0.0.1/ in the browser address bar. If "It works." appears, congratulations, apache has been successfully installed; at the same time, click on the taskbar in the lower right corner of the computer. There is a green apache server running icon.

Apache also has a configuration file: httpd:conf that needs to be configured in order for php to run. The location is: D:Program FilesApacheconf directory. Open httpd:conf:
1), search for "DocumentRoot", this is the directory where the specified homepage is placed. The default is: "D:Program FilesApachehtdocs". You can use the default directory or define one yourself, such as: "D:/PHP". Note: Do not add "/" at the end of the directory.
2) Search for "DirectoryIndex", which is the default home page file name. You can add index.php, etc. after index.html. Leave a space between each type.
3), find

Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all

Modify to:

Options FollowSymLinks
AllowOverride None
Order deny,allow
allow from all

If you don’t change this If so, an error message like You don't have permission to access / on this server. may appear, especially after changing the path of the default homepage.

Note: Every time you modify the httpd:conf file, you must restart the apache server. In addition, if your win32 system is also running an iis server, you must first stop the iis server and then start apache, otherwise the apache server cannot start.

How to install and configure Php

First download the windows version from the official website of php 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 uses version 5.2.9. PHP 5.2.9 installer is an automatic installation method. Although it is relatively automated, it is limited in many aspects. Therefore, pharmar does not recommend this method. The following describes the manual installation of PHP 5.2.9 zip package.

1) Unzip the PHP compressed package zip to a directory. Recommended: "C:/PHP", the pharmar is D:Program FilesPhp.
2) Rename the php.ini-dist file in the PHP directory (D:Program FilesPhp) to php.ini. This is the configuration file of PHP. Modify the following places. After modification, change php.ini Copy the file to the C: WINDOWS directory:
extension_dir="D:Program FilesPhpext", pointing to the path where the "php_*.dll" file is placed in the php folder. The paths for PHP4 and PHP5 are different here.
doc_root="D:PHP", points to the homepage location set by apache previously;
default_charset="gb2312", modifies the default character set. Here, if there is a semicolon ";" in front of it, remove the semicolon;
register_globals=Off changed to register_globals=On to make passing global variables 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 for drawing, generally used for graphical verification codes;
extension=php_mysql.dll is used to connect to MYSQL database;
3) Copy the php5ts.dll file in the PHP directory to C:WINDOWSsystem32 Table of contents.
4), finally modify Apache’s httpd.conf file. Add the following 2 lines at the end of the file to install PHP into Apache in module mode:
LoadModule php5_module D:/Program Files/Php/php5apache2_2.dll
AddType application/x-httpd-php .php

Note: The directory path in the first line must be updated to the current version of the apache dynamic link library. For example, here I am using the apache2.2.11 version and php5.2.9, then this file must be php5apache2_2.dll, not php5apache2_2.dll. php5apache.dll, php5apache2.dll, etc. The second line is the suffix of the php script.
In the php4 version, you need to add a line AddType mod_php4.c, but in php5, there is no need for such a line AddType mod_php5.c. php5 has been integrated, otherwise apache cannot start.

The above completes the configuration process of apache and php, restart apache. Create a new file index.php in the server's default directory "D:Program FilesApachehtdocs" and write the following code:
phpinfo();
?>
In the browser address Enter http://127.0.0.1/ or http://localhost/ in the column, and you will see the php version information. So far, php and apache have been successfully installed.

Here is a detail: the directory delimiter in Apache's configuration file httpd.conf is "/", while the directory in PHP's configuration file php.ini requires a backslash " ", don't do it Mixed up.

The installation of MYSQL is simple. Go to the official website http://dev.mysql.com/downloads/mysql/5.0.html, download mysql under the windows platform, select Windows ZIP/Setup.EXE (x86), the latest version is 5.0.77, and download it. Install directly. After the installation is completed, you can enter the configuration wizard and set the mysql database password. Everything is OK.
For the installation and configuration of mysql, please see: phpMyAdmin installation configuration method and problem solving

Errors encountered during the pharmar installation process:
Apache appears after installing PHP under Windows The main reason for the error LoadModule takes two arguments is this sentence in httpd.conf:
LoadModule php5_module D:Program FilesPHPphp5apache2_2.dll
The interpreter treats the spaces in Program Files as the separator of the two parameters. Therefore, spaces cannot appear in the statement.I searched online for a long time and couldn't find a solution. Finally, I solved the problem by using the first-level directory symbol and changed it to the following:
LoadModule php5_module ../php/php5apache2_2.dll
Because apache is installed in the D:Program FilesApache directory Next, PHP is installed in D:Program Filesphp, so ../ means the D:Program Files directory. This is finally solved. I hope everyone will use their brains during the installation and configuration process to find a way.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/320246.htmlTechArticleBecause pharmar uses Mcafee’s anti-virus software, all programs are required to be installed in Program Files, so these files are Place it under D:Program Files for easy management. Mcafee is good when writing protection rules...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template