Installation and configuration of Apache Tomcat Windows PHP5 and Apache

Source: Internet
Author: User
Tags apache php apache tomcat
Download the installation program
Apache can download from http://www.apache.org/dyn/closer.cgi/httpd/binaries/win32/
PHP can be downloaded from http://www.php.net.
Two installation programs
1, Apache program installation is relatively simple, we come down from the site is a Windows installation program, we can directly double-click to run, so that we facilitate the Apache on our computer on the next.
2, we have to pay attention here is to download php must download the zip package, and do not download installer. Unzip the PHP package that we downloaded to the root directory under C, and rename the extracted folder to PHP.
Three configurations
1. It is best to ensure that Php5ts.dll is available regardless of the interface (CGI or SAPI), so you must place this file in the Windows path. The best location is the Windows system directory:
C:\Windows\System for Windows 9x/me
C:\Winnt\System32 for Windows nt/2000 or c:\winnt40\system32 for Windows nt/2000 Server Edition
C:\Windows\System32 for Windows XP
2, the next step is to set a valid PHP configuration file, php.ini. The compressed package includes two INI files, 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.
Copy the selected INI file to the directory that PHP can find and rename it to PHP.ini. PHP searches for php.ini by default in the Windows directory:
3 Copy the selected INI file to%WINDIR% under Windows 9x/me/xp, typically C:\Windows.
Copy the selected INI file under Windows nt/2000 to%WINDIR% or%SYSTEMROOT%, usually C:\Winnt or C:\WINNT40 corresponds to the server version.
4 PHP settings in Apache
There are two ways to make PHP work in Apache under 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 edit httpd.conf 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:
PHP is installed in CGI to Apache 2.0:
scriptalias/php/"c:/php/"
AddType application/x-httpd-php. php
Action application/x-httpd-php "/php/php.exe"
If we want to use PHP as a module for Apache 2.0, then be sure to move Php4ts.dll to Winnt/system32 (Windows nt/2000) or Windows/system32 (Windows XP), overwriting the original file (e.g. If any), for PHP 5, this file is Php5ts.dll. Then we will insert the following two lines into httpd.conf so that our PHP is installed as Apache php-module:
PHP is installed in a modular manner to Apache 2.0:
; For PHP 4 does something like this:
LoadModule php4_module "C:/php/php4apache2.dll"
AddType application/x-httpd-php. php
; For PHP 5 does something like this:
LoadModule php5_module "C:/php/php5apache2.dll"
AddType application/x-httpd-php. php
After this configuration, we have installed our PHP and Apache servers. We can simply test:
1. Test Apache:
We open the browser, enter localhost in the address bar, if the Apache page can appear, then our Apache can work properly.
2. Test PHP Settings:
We can simply write a PHP page, we can use a text editor, enter the following code:
<title>
Hello
</title>
<body>
<?php echo "hello,php";?
</body>
Then save the file as hello.php, place it in the Apache Htdocs directory (we can also change the directory in the http.conf file), and then enter http://localhost/hello.php in our browser, If we can display hello,php correctly, we can see that our PHP configuration is working properly.
So we can design our PHP site later.

The above describes the installation and configuration of Apache Tomcat Windows PHP5 and Apache, including the Apache Tomcat content, and hopes to be helpful to those interested in PHP tutorials.

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