PHP Modular Installation Tutorials _php Tips

Source: Internet
Author: User
Tags install php php language php database php programming php regular expression win32

This article describes the method of modular installation of PHP. Share to everyone for your reference, specific as follows:

PHP (hypertext Preprocessor) This is a simple but powerful scripting language, which is based on the WINDOWSXP+SP2 operating platform apache2.0.53+ The php5.2.1 installation and basic configuration process is documented for reference:

First, download the following program from the official website:

1. Apache_2.0.53-win32-x86-no_ssl.exe
2. Php-5.2.1-win32.zip (binary compression package)

Second, the installation and configuration process:

1. Install Apache WEB Server:

Double-click the installation file Apache_2.0.53-win32-x86-no_ssl.exe to install it under the D:/apache directory (I created the Apache folder in D disk),

-------------------------------------------------------
+ Note: The following problems may occur with the installation process:
+ OS 10048 typically each socket address (Protocol/network address/port) is allowed only once:
+ Make_sock:could not bind to address 0.0.0.0:80 ... "Typically IIS takes up 80 ports
+ Two ways to solve the problem:
+ 1, open the Control Panel-> service to locate the IIS Admin service shutdown and disable
+ 2, if you do not want to turn off 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) such as Listen 8080
+ But then, when you visit the Web service under your Apache, add the port number after the domain name.
+ such as: http://localhost:8080
-------------------------------------------------------

Test Apache for successful installation, will be entered in the browser: http://localhost:8080/http://localhost If you can see the flag feathers of Apache, then congratulations!!!

2. Install PHP:

The contents of the Php-5.2.1-win32.zip to d:/php (i in D Disk new PHP folder), found in the PHP directory php.ini-dist renamed to PHP.ini and copy to the Windows directory. The Php5ts.dll,libmysql.dll in the d:/php directory is then copied to the system directory (WINDOWS/SYSTEMS32).

Configure the httpd.conf in Apache

Open d:/apache2/conf/httpd.conf This file
Locate Adddefaultcharset iso-8859-1 change it to Adddefaultcharset GB2312 (let the default language be encoded in Simplified Chinese)
Find DocumentRoot "D:/apache2/htdocs" to change it to your Web directory (do not change) as my DocumentRoot "G:/web Project"
Find DirectoryIndex index.html Index.html.var in the back and add index.htm index.php

Select installation mode: Modular installation or CGI mode Setup (optional)

Modular installation Configuration

Locate the line #LoadModule Ssl_module modules/mod_ssl.so, and then add a line after the row:

LoadModule Php5_module D:/php/php5apache2.dll

Where D:/php/php5apache2.dll is the location of the Php5apache2.dll in your PHP directory

Note: LoadModule php5_module D:/php/php5apache2.dll
Note: C:/php5/php5apache2.dll is the appropriate path for you to install PHP. Don't confuse Php5apache2.dll with Php5apache2 _2.dll.

Php5apache2.dll is only available for Apache version 2.0.

If it is apache2.2.* or above, thecannot load C:/php/php5apache2.dll into Server:the specified module could the not is found may appear. Or: "The requested operation has failed"

Find AddType application/x-gzip gz. tgz, join a line after this row

AddType application/x-httpd-php. php

CGI installation configuration

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

scriptalias/php/"d:/php/"
addtype application/x-httpd-php. php
Action application/x-httpd-php "/php/ Php-cgi.exe "

Note: The CGI English name is Common Gateway Interface, which is usually translated into a common Gateway interface and is an interface for HTTP servers to communicate with other programs on the machine. This "other program" can be written in any computer language, which obtains input from the HTTP server through the CGI interface, and then sends the results of the operation to the HTTP server via the CGI interface, which is sent to the browser by the HTTP server.

CGI makes the web from static to dynamic, as the web becomes more and more popular, many sites need to have dynamic pages, so as to exchange with the visitors. The shortcomings of the CGI approach are becoming more and more prominent. Because HTTP to generate a dynamic page, the system must start a new process to run the CGI program, constantly fork is a time-consuming and resource-intensive work. This shows up the fastcgi.

FastCGI is like a resident (long-live) CGI, which can be executed all the time, and it won't take a while to fork once (this is CGI's most criticized Fork-and-execute model).

The PHP environment is basically configured successfully at this time

In the Web root directory (such as my d:/website), build a file named test.php that reads as follows

Restart the Apache service

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

OK if you can see the PHP configuration output information

Note: Modular Installation mod_php is to make PHP a built-in module of Apache. Let the Apache HTTP server itself be able to support the PHP language, without requiring every request to start the PHP interpreter to explain PHP.

More interested in PHP related content readers can view the site topics: "PHP Math Arithmetic Skills summary", "PHP operation Office Document Skills Summary (including word,excel,access,ppt)", "PHP Array" operation Skills Encyclopedia, " Summary of the PHP sorting algorithm, "PHP commonly used traversal algorithm and skills summary", "PHP Data structure and algorithm tutorial", "PHP Programming Algorithm Summary", "PHP Regular Expression Usage summary", "PHP operation and operator Usage Summary", "PHP string (String) Usage summary" and " A summary of common PHP database operations tips

I hope this article will help you with the PHP program design.

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.