PHP modular installation tutorial, php modular tutorial

Source: Internet
Author: User

PHP modular installation tutorial, php modular tutorial

This article describes the PHP modular installation method. We will share this with you for your reference. The details are as follows:

PHP (Hypertext Preprocessor) is a simple but powerful scripting language, the following is a record of Apache2.0.53 + php5.2.1 installation and basic configuration on the Windows XP + sp2 operating platform for your reference:

1. download the following programs from various official websites:

1. apache_2.0.53-win32-x86-no_ssl.exe
2. php-5.2.1-Win32.zip (Binary compressed package)

Ii. installation and configuration process:

1. install apache Web Server:

Install apache_2.0.53-win32-x86-no_ssl.exe in the d:/Apache directory (I have created an Apache folder on drive D) in the double-hitting Installation File apache_2.0.53-win32-x86-no_ssl.exe,

-------------------------------------------------------
+ Note: the following problems may occur during installation:
+ OS 10048 generally, each socket address (Protocol/network address/port) can be used only once:
+ Make_sock: cocould not bind to address 0.0.0.0: 80... "is generally caused by IIS occupying port 80.
+ Two solutions:
+ 1. Open Control Panel-> service find IIS admin Service close and disable
+ 2. If you do not want to disable the IIS service, you can change the port used by apache to another port.
+ Change Listen 80 in apache2/conf/httpd. conf to Listen (the port you want to use), for example, Listen 8080.
+ However, when you access your apache Web service, you need to add the port number after the domain name.
+ For example, http: // localhost: 8080
-------------------------------------------------------

To test whether Apache is successfully installed, enter: http: // localhost: 8080/http: // localhost in the browser. If you can see the Apache flag feathers, Congratulations !!!

2. install PHP:

Decompress the content in the php-5.2.1-Win32.zip to D:/PHP (I created a new PHP folder on drive D), find php in the php Directory. rename ini-dist to php. ini and copy it to the windows directory. Copy php5ts. dll and libmysql. dll in the D:/PHP Directory to the system directory (windows/systems32 ).

Configure httpd. conf in apache

Open the file D:/Apache2/conf/httpd. conf.
Find the adddefadefacharset ISO-8859-1 and change it to adddefadefacharset GB2312 (to make the default language encoded as simplified Chinese)
Find DocumentRoot "D:/Apache2/htdocs" and change it to your WEB directory (do not change it). For example, my file is DocumentRoot "G:/Web Project"
Find DirectoryIndex index.html. var and add index.htm index. php.

Select the installation mode: Modular installation or CGI installation (select the same)

Modular installation Configuration

Find the # LoadModule ssl_module modules/mod_ssl.so line, and add a line after this line:

LoadModule php5_module d:/php/php5apache2.dll

Where d:/php/php5apache2. dll is the location of php5apache2. dll in your php Directory.

Note: LoadModule php5_module d:/php/php5apache2. dll
// Note: C:/php5/php5apache2. dll is the path for installing php. Do not confuse php5apache2. dll with php5apache2 _ 2. dll.

Php5apache2. dll is only applicable to apache 2.0.

For example, if apache2.2. * or a later version is used, "Cannot load C:/php/php5apache2. dll into server: The specified module cocould not be found. "Or:" The requested operation has failed"

Find the AddType application/x-gzip. gz. tgz line, and add a line after this line

AddType application/x-httpd-php .php

CGI installation Configuration

Find AddType application/x-gzip. gz. tgz and add the following line:

ScriptAlias /php/ "d:/php/"AddType application/x-httpd-php .phpAction application/x-httpd-php "/php/php-cgi.exe"

Note: CGI is the Common Gateway Interface, which is usually translated as a Common Gateway Interface. It is an Interface for the HTTP server to communicate with other programs on the machine. This "other program" can be written in any computer language. It obtains input from the HTTP server through the CGI interface, and then delivers the running result to the HTTP server through the CGI interface, the HTTP server sends the result to the browser.

The emergence of CGI changes the WEB from static to dynamic. As the Web becomes increasingly popular, many websites need dynamic pages to interact with viewers. The disadvantage of CGI is becoming more and more prominent. To generate a dynamic page for HTTP, the system must start a new process to run the CGI program. Continuously fork is a task that consumes a lot of time and resources. FastCGI appears.

FastCGI is like a long-live CGI. It can be executed all the time, it will not take time to fork every time (this is the most criticized fork-and-execute mode for CGI ).

Now, the PHP environment is successfully configured.

In the WEB root directory (such as my D:/website), create a file named test. php with the following content:

Restart the apache service

Open http: // localhost/test. php in a browser or in LINUX:/usr/local/php/bin/php-f test. php

If you can see the php configuration output information, OK

Note:Modular installation of mod_php is to use PHP as a built-in module of APACHE. The apache http Server supports the PHP language and starts the PHP interpreter to explain PHP without every request.

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.