Mainstream Apache2PHP5 installation and usage introduction _ PHP Tutorial

Source: Internet
Author: User
Mainstream Apache2PHP5 installation and use introduction. We all know that Apache2 and PHP are popular solutions for creating interactive websites, with low costs. Here we will talk about the installation of Apache2PHP5 and the tips in detail. in PHP, we all know that Apache 2 and PHP are popular solutions for creating interactive websites, and the cost is very low. Here we will introduce the installation of Apache 2 PHP5 in detail. the Windows installation section in the PHP 4.3 Manual does not explain how to use Apache 2 PHP5 together, the installation section on Apache 2 PHP5 lacks a lot of information you need. Other installation guides published on the Internet also contain many errors, so some installers have to keep experimenting and making mistakes. For example, some may even replace php dll with other PHP versions. OK. in order to save your precious time, we have prepared this most authoritative guide article to help you eliminate all your troubles.

Use the correct version of Windows

First, let's talk about compatibility: Apache 2 cannot run on Windows 95; it can barely run on Windows 98, but cannot be used as a service. PHP does not support Windows 95 any more since version 4.3. Therefore, your Windows OS must be Windows NT, 2000, or XP.

Apache 2: source code or binary code?

If you have Visual C ++ 5.0 or a later version, or you have installed Microsoft Visual Studio, you can generate Apache based on the source code, but never do so. In Visual Studio IDE, the generation process in Windows is very complex. Even compiling from the command line is definitely not an easy task. Therefore, unless you like to create makefile, you 'd better get a Windows Installer binary release package, that is, A. msi file. If you have enough knowledge about Apache and know which custom operations you want to perform, you can generate (compile) Apache by yourself.

If you have installed and are running an earlier version of Apache, stop it, uninstall it, and then start installing the new server. Apache 2 of multiple versions cannot coexist.

Double-click the Apache 2. msi file. After agreeing to the license agreement, set the Network Domain and Server Name correctly (if you do not want to install Apache on a remote computer, set localhost ), in the Administrator's Email Address area, enter your Email Address to keep Port 80/service option selected. In the next dialog box, if you select Typical for installation, you can quickly obtain a server environment that can actually work.

Apache 2 PHP5 installation prompt

We recommend that you change the default installation directory from C: Program FilesApache Group to C: Apache or a name that complies with the 8.3 file name format. In this way, you do not need to add quotation marks for each input Apache installation path.

Wait a moment. the installation wizard will tell you that Apache 2 is successfully installed. The only thing to do next is to perform a test. open your browser and visit localhost. the default Apache 2 homepage is displayed.

You can then delete all the sample files in the master Web server directory, which are located in C: InstallDirectoryApacheApache2htdocs by default. If you have a primary page index.html, copy it here. In addition, you can create a blank homepage immediately. For uninitialized HTML, you can use the following code:

 
 
  1. <html>
  2. <head>title=default server page head>
  3. <body>Default server page body>
  4. html>

Prepare Apache 2 for PHP

From now on, you need to install it manually. you cannot simply click or select several options. Get used to it as soon as possible. this is the Apache method. You need to edit the file to set different configuration options. if the operation is not proper, your modifications will impede the correct loading of Apache. If the setting causes an error, the error may be recorded in the Apache 2 error log (default: C: InstallDirApache2LogsError. log ). However, there are few records that can be recorded like this. most errors are recorded only in Windows event logs (start | set | control panel | management tools | event viewer ).

Unfortunately, Windows event logs are not a convenient tool when you debug the installation settings. A better way is to test Apache server loading in the command line window, so that you can see the error report immediately. Therefore, after completing the configuration changes I will discuss, open a command line window, switch to the Apache binary Directory (C: InstallDirApache2bin), and start Apache there. The Apache configuration file is C: ApacheApache2ConfHttpd. conf, which can be edited in any text editor. Find the DirectoryIndex and locate the following line:

 
 
  1. DirectoryIndex index.html index.html.var # index.php

To allow Apache to process PHP pages, delete the comment character (#) and change it:

 
 
  1. DirectoryIndex index.html index.html.var index.php

You can also use the. htaccess file in any Directory. Therefore, search for AllowOverride in the configuration file and change the setting from None to All. After saving the changes, you can continue to open the file in the text editor, because you need to edit the file again later when installing PHP.


Community 2 and PHP are popular solutions for creating interactive websites, with low costs. Here we will introduce the installation of Apache 2 PHP5 in detail...

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.