Modular installation of PHP in NT series OS

Source: Internet
Author: User
In various network programming languages. PHP is easy to learn and powerful, attracting many programmers. However, the installation of PHP has become a obstacle for many beginners. Next, I will give you a more detailed introduction of a modular method to install PHP and common modules on the Microsoft Windows2000/XP platform. I. before introducing the basic knowledge, please first understand some P in various network programming languages. PHP is easy to learn and powerful, attracting many programmers. However, the installation of PHP has become a obstacle for many beginners. Next, I will give you a more detailed introduction of a modular method to install PHP and common modules on the Microsoft Windows 2000/XP platform.
 

I. basic knowledge
Before introduction, please first learn some basic PHP installation knowledge. PHP has two different installation methods: CGI and modularization.

For PHP installed in CGI mode, each time the PHP script is parsed, the server will generate a temporary PHP parser (process) to parse the PHP script. When the traffic volume is large, the Server performance will be reduced.
The modular installation of PHP runs in the same memory address as the Apache server. It has a considerable performance improvement and higher security than CGI.
 
Therefore, modular installation is superior to CGI installation. The related software is listed below:

Apache Server version 2.0.43 is used. : Http://www.apache.org/
PHP uses a newer version 4.32 with good security and stability, and supports modular installation. : Http://www.php.net/
II. install the Apache server
When the relevant software is ready. Install Apache 2.0.43 first. The default installation path is the start menu of C:. we recommend that you change the path to the C root directory. In this way, it is more convenient for daily use.

After Apache is installed. Note that a red feather flag will appear in the system tray area of the taskbar. If a green triangle is under the feather. Indicates that Apache is successfully installed and is running. If a red stop sign appears, it indicates a problem occurs during the installation process. generally, a port conflict occurs. If a server such as IIS is installed on your machine, check whether port 80 is occupied by IIS. If you want Apache to use another port, OK. Choose Edit the Apache httpd in Configure Apache Server of Apache HTTP Server 2.0.43 in the Start menu. conf Configuration File. after opening the File (we recommend that you install a text editor such as UltraEdit with a line number), the words "Listen 80" are displayed in around 120 lines. Indicates that Apache uses port 80 by default. You can change it to the port you want. You only need to add the modified port number during browsing. For example, http: // localhost (: port number)/index.html. en. this is the start page of Apache.

III. modular installation of PHP
After installing Apache, an important step begins. Decompress the downloaded PHP4.32 to the C root directory. Generally, the default folder name should be in the php-4.3.2-Win32 format and be changed to php. Change the php. ini-dist file to php. ini, and copy the file to the C: \ WINNT or C: \ WINDOWS directory. (Here is a little bit of knowledge. if the system directory and PHP Directory both have the php. ini configuration file, PHP will first execute the one in the PHP directory !) This is also a problem that many friends often encounter when using PHP. The php. ini in the system directory was modified, but the desired result was not implemented after running. The reason is here!

The following is the most important step. Open the Apache configuration file httpd. conf again, which is about 172 lines. Similar

# LoadModule ssl_module modules/OS
. LoadModule indicates the loading module. Similarly, we can configure Apache to load the PHP module to implement modular installation of PHP. In line 3, we will add the LoadModule php4_module C:/php/sapi/php4apache2. dll statement. The Apache module used to call PHP. The following path changes with the PHP installation path on your machine. Finally, in row 354, we add

AddType application/x-httpd-php. php. html
Statement, indicating the extension of the Apache parsing file.

Last. Copy the php4ts. dll file in the PHP folder to the SYSTEM32 folder in the system directory. Restart Apache.

OK. Do you see the Apache/2.0.43 (Win32) PHP/4.3.2 Flag in the status bar below Apache Server Monitor (right-click the feather flag on the system tray of the taskbar? If yes. The PHP modular installation is successful! It does not matter if you do not see it. check the above steps to see if there are any omissions. Create a file write


Save it to the htdocs folder in the Apache installation directory and open it in IE. Apache 2.0 Handler should be found in the Server API on the third line of the displayed system information, indicating that PHP is installed in a modular manner. Since then, PHP installation has come to an end.

3. install common modules
In the daily PHP program development process, we often use some modules. For example, the GD module used to process images and the MD5 module used to encrypt images. So how are these modules loaded into PHP? Next we will take the installation of the GD module as an example to introduce the installation methods of various modules in PHP.

Open the php. ini configuration file in a text editor. Extension_dir = "./" is the path of commonly used extension modules. You do not need to change it. To install the GD library below, we will change it

Extension_dir = c:/php/extensions/
Indicates the path of the PHP extension file. After modification, find row 546. Will find many

; Extension = php_gd2.dll
. Various. dll files indicate various modules that PHP can load. by default, they are blocked. we will remove the semicolon before the 546 line extension to remove the blocking. After modification, save it to the system folder (do not forget to have the PHP folder ). Restart the Apache server and execute the above PHP file to view the basic PHP information. The path is found in the Configuration project table.

Extension_dir | c:/php/extensions/
A gd table is found below, indicating that the GD is successfully installed!

The installation of other modules is similar to that of the GD module. you can load them as needed. Do not forget to restart the Apache server after modifying the file. Otherwise, no results are displayed.

PHP has many advantages in building small and medium-sized projects. However, the installation is relatively complex. many PHP enthusiasts prefer to use some integrated installation packages on the Internet for one installation. However, I do not recommend using the installation package, which is not conducive to understanding some concepts in PHP. In addition, you need to manually load modules in the future. This article describes in detail the optimal installation of PHP and the loading of modules. Hope to help beginners to take the first step in learning WEB development technology.

Illustration:
1. even the Apache Server configured on the machine
2. the basic PHP information on the machine. the machine is Intel Celon 1G/256 MB/40G 7200 rpm/, and OS is Windows Server 2003. the Zend Optimizer and Zend Encoder encryption program are installed. in this way, more content is displayed on the graph.

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.