Installation and configuration of PHP and Apache under Windows

Source: Internet
Author: User
Here take PHP5 as an example to introduce the PHP under Windows and ApacheInstallation and configuration.

First, the program download

You can download the Php5.2.4zip package from here and download Apachefrom here.

Second, the program installation

1.Apache installation is relatively simple, double-click the downloaded installer can be installed on our computer Apache ;

2. Unzip the PHP package (extension Zip) We downloaded to the C packing directory and rename the directory to "PHP".

Third, the program configuration

1. Copy the Php5ts.dll to the Windows path. Preferably in the system directory of Windows

OS Path
Windows 9x/me C:/windows/system
Windows nt/2000 C:/winnt/system32
Windows nt/2000 Server Edition C:/winnt40/system32
Windows XP C:/windows/system32

2. Set the PHP configuration file php.ini. There are two INI files in the compressed package, php.ini-dist and php.ini-recommended. It is recommended to use php.ini-recommended because this file is optimized for performance and security on the default settings;

3. Under Windows/9x/me/xp, copy the selected INI file to the C:/windows directory;

4. PHP settings inApache . There are two ways to make PHP work under the Apache of Windows. One is to use a CGI binary file and the other is to use the Apache module DLL. Either way, you first have to stop the Apache Server and then modify the httpd.conf file to configure Apache and PHP to work together. If we are going to use a CGI binary file, we will insert the following instruction into the Apache httpd.conf configuration file to set up the CGI binary file:

Scriptalias / PHP / " c:/php/ "
Addtypeapplication/x-httpd-php. PHP
Actionapplication/x-httpd-php" /php/php.exe"

If we want to use PHP as Apachemodule, then be sure to MovingTo Winnt/system32 (Windows nt/2000) or Windows/system32 ( Windows XP), overwriting the original file (if any), for PHP5, this file is Php5ts.dll. Then we are going to insert the following two lines into httpd.conf so that our PHP as ApacheThe Php-module installation. PHP is installed in a modular way to Apache

; for PHP 4 Do Somethinglikethis :
Loadmodulephp4_module"c:/php/php4Apache2.dll"
Addtypeapplication/x-httpd-php. PHP

; for PHP 5 Do Somethinglikethis :
Loadmodulephp5_module"c:/php/php5Apache2_2.dll"
Addtypeapplication/x-httpd-php. PHP

Iv. Testing

After this configuration, we have installed the PHP and Apache server. After installation, we also need to test whether our installation is correct.

1. Test Apache

We open IE, enter localhost in the address bar, if the Apache page can appear, then our Apache can work properly.

2. Test PHP

We can simply write a PHP page to test whether PHP is properly installed and configured.

< HTML >
< Head >
< title > Hello title>
Head >
< Body >
Phpecho "hello,php"; ?>
Body >
HTML >

Then save the file as hello.php, put it in Apache 's Htdocs directory (we can also change this directory in the http.conf file), and then enter the http://localhost:80/in our IE hello.php, if we can display the hello,php correctly, our PHP configuration will work properly.
In this way we can also design our PHP site.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

The above describes the installation and configuration of PHP and Apache under Windows, including the content of Apache,windows XP, I hope that the PHP tutorial interested in a friend helpful.

  • 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.