Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of PHP Modular installation

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces the PHP modular installation example analysis, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.

The details are as follows:

PHP (Hypertext Preprocessor) is a simple but powerful scripting language. Here is a record of the installation and basic configuration of Apache2.0.53+php5.2.1 under the WindowsXP+sp2-based operating platform for reference:

First, download the following programs from the official websites:

1. Apache_2.0.53-win32-x86-no_ssl.exe

2. Php-5.2.1-Win32.zip (binary package)

2. Installation and configuration process:

1. Install the apache Web server:

Double-click the installation file apache_2.0.53-win32-x86-no_ssl.exe to install it in the D:/Apache directory (I created a new Apache folder on disk D)

+ Note: the following problems may occur during installation:

+ OS 10048 is usually allowed only once per socket address (protocol / network address / port):

+ make_sock: could not bind to address 0.0.0.0 IIS 80... "is usually caused by port 80 occupied by IIS.

+ two solutions:

+ 1. Open Control Panel-> Service finds IIS admin service shuts down and disables

2. If you do not want to shut down 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 add the port number after the domain name when you access the Web service under your apache

+ such as: http://localhost:8080

To test whether Apache is installed successfully, you will enter in the browser: http://localhost:8080/http://localhost if you can see the logo feather of Apache, then the installation is successful!

two。 Install PHP:

Extract the contents of php-5.2.1-Win32.zip to D:/PHP (I created a new PHP folder on disk D), find the php.ini-dist in the php directory and rename it to php.ini and copy it to the windows directory. Then copy the php5ts.dll,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 AddDefaultCharset ISO-8859-1 and change it to AddDefaultCharset GB2312 (let the default language be encoded in simplified Chinese)

Find DocumentRoot "D:/Apache2/htdocs" and change it to your WEB directory (but do not change it) if mine is DocumentRoot "G:/Web Project"

Find DirectoryIndex index.html index.html.var and add index.htm index.php after that.

Select installation mode: modular mode installation or CGI mode installation (choose one)

Modular installation configuration

Find the line # LoadModule ssl_module modules/mod_ssl.so 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: where C:/php5/php5apache2.dll is the corresponding path where you install php. Don't confuse php5apache2.dll with php5apache2 _ 2.dll.

Php5apache2.dll is only available in apache version 2.0.

If it is apache2.2.* or above, "Cannot load C:/php/php5apache2.dll into server: The specified module could not be found." Or: "The requested operation has failed"

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

AddType application/x-httpd-php .php

CGI installation configuration

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

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

Note: the full name of CGI is Common Gateway Interface, which is usually translated as common gateway interface. It is an interface through which the HTTP server communicates with other programs on the machine. This "other program" can be written in any computer language. It takes input from the HTTP server through the CGI interface, and then sends the running result to the HTTP server through the CGI interface, and the HTTP server sends the result to the browser.

The emergence of CGI changes WEB from static to dynamic. With the increasing popularity of Web, many websites need dynamic pages in order to interact with visitors. The shortcomings of the CGI approach are becoming more and more prominent. Because HTTP wants to generate a dynamic page, the system must start a new process to run CGI programs. Fork constantly is a time-consuming and resource-consuming task. Here comes the FastCGI.

FastCGI is like a resident (long-live) CGI that can be executed all the time, as long as it is activated and does not take the time to fork every time (this is the most criticized fork-and-execute mode of CGI).

At this time, the PHP environment has basically been configured successfully.

Create a file named test.php in the WEB root directory (such as my D:/website) as follows

Restart the apache service

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

If you can see the php configuration output, it will OK.

Note: modular installation of mod_php is to use PHP as a built-in module of APACHE. Let the apache http server itself support the PHP language and start the PHP interpreter to interpret PHP without every request.

Thank you for reading this article carefully. I hope the article "sample Analysis of PHP Modular installation" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report