PHP4.23 Install instances on two servers under WindowsXP

zhaozj2021-02-16  46

Recently, many friends have a friend asked me to install the PHP under WindowsXP, just recently I have installed PHP4.23 in modular ways on my own machine. Since so many friends need, I will write PHP as an example with the most common IIS and Apache servers, write PHP to the installation process under WindowsXP, I hope to help friends who want to install PHP. If you do not add special instructions, the following introduction also applies to Win2000 versions.

1. Overview: Between the installation, you must first understand the two different modes of PHP installation, one is CGI mode, and the other is a modular installation method. You can distinguish this: In CGI mode, if the client requests a PHP file, the web server calls php.exe to explain this file, and then return the result of the explanation to the client in the form of a web page; in the modularity The PHP is started and running with the web server, so from a certain point of view, PHP4 installed in Apache module is better security and better execution efficiency and speed than the CGI mode. Second, software preparation: "The so-called" worker must be in a good thing ", you want to run PHP on your machine to first prepare the required software.

(1) Web server

First you need a web server to support PHP operation, here we choose two of the most common, and use the largest two servers to introduce. 1.IIS (Internet Infomation Server) IIS, you must be unfamiliar, in Window2000, IIS is installed by default. You can open it through "Start -> Settings -> Control Panel -> Administrative Tools -> Internet Information Services". If you are not installed, you can install it via Windows "Add Remove Components". There are many introductions on IIS installation online, and it will not be introduced here. 2.Apache Apache is also a very good web server program, and it is also a favorite web server of the author. It is not only small, flexible, and is very stable during use, there will be no more inexplicable errors (IIS is relatively large), more importantly, it also supports the PHP to be installed into a module. Therefore, the author strongly recommend that you use Apache to install PHP. Now there are two versions, one is 1.36 version, the other is the version of the Apache2 series, hereby recommend you to use the Apache2 version, you can download to the latest version on Apache, you can also at this site (http://www.hooday.com) The download section downloaded to the author in writing this article (Apache 2.040). Apache official website: http://www.apache.org

(2) PHP program

The latest PHP program code You can download it in its official website http://www.php.net/downloads.php, Note To select the ZIP package, you can't choose to install it, when writing this article, PHP The latest version is version 4.23, the size is 5,417kb. Of course, you can also download them in the download section of this site.

All right. The software is ready, starting our PHP installation journey :) Note: The following installation is based on the PHP4.23 version, Apache 2.040 is subject to.

Third, the installation under IIS:

1. Unfold the downloaded PHP installation package to your C drive root directory (here you can choose C ", you can also choose a different directory), you can also choose a different directory), you should get a similar" PHP- 4.2.3-win32 "directory, change the directory name to" PHP ". 2. Open the PHP directory you just decompressed, you will find a file called "php.ini-dist", this is the PHP configuration file, you need to change it to "php.ini", then copy it to the system directory In (if your system is installed in the C drive, XP is "c: / windows", and Windows 2000 is "C: / WinNT"). Previously, many articles describing the PHP installation files have to modify the value of "Extension_Dir" and "DOC_ROOT" in php.ini, but the author has not changed in the installation of the PHP, and there has been no mistake, it seems that this Two parameters are not required. Of course, if you don't worry, you can modify it. Change DOC_ROOT to your server root directory, change Extension_Dir to the absolute path in the Extensions folder in your PHP installation folder. 3. Open your IIS Information Service Console, right-click the "Default Site" icon, select the property, open the default website property selection, then select the "Main Directory" tab, as shown below: Click the "Configuration" button, you Will see a tab and you are the type of document already defined. Click the "Add" button. In the executable file text box of the dialog box, type "% s% s" in the absolute path of your php.exe, here is "c: / php/php.exe % s% s ", write the suffix name you require PHP program processing in the Extended Names box, where we write" .php ", the following options can be set by default. As shown below:

4. Ok. Now try to save the following segments into a suffix for the PHP file, then put it in a virtual directory to visit, see if it can appear normal results. Maybe you will encounter the following output results:

Security Alert! The PHP CGI can not be accessed directly. This PHP CGI binary was compiled with force-cgi-redirect enabled. This means that a page will only be served up if the REDIRECT_STATUS CGI variable is set, e.g. via an Apache Action directive.

For more information as to why this behaviour exists, see the manual page for cgi security.

.

You don't have to be afraid, this is because now PHP is running in the CGI mode in IIS, and this item in your PHP configuration file is not open. If you see a warning on the above, you need to open your php.ini file, then find "cgi.force_redirect = 1" such a sentence, remove the semicolon in front of this sentence, then change 1 to 0 is OK, Now let's refresh your page, if there is no accident, the result of your screen should be similar to the screenshot below. At this point, the installation process of PHP on IIS has been completed. Note that I indicated by the red line in the figure that PHP is running in CGI mode. (Click to enlarge) Fourth, installation under Apache:

We used Apache's new version apache2. I used to install php under Apache. I still have trouble. Now in the Apache2 platform, we can easily install PHP in modular way. Prerequisite is that the PHP version must be 4.0 or more of. Of course, it is still very few in PHP3. So this time we only introduce how to install PHP in Apache in a modular way. If you want to know how to load PHP in CGI under apache, you can refer to another article in this site "PHP Apache under Win9x Installation and configuration "(http://www.hooday.com/?n=ReadArticle&a=34). Ok, gossip less, let us take the style of the modular installation of PHP.

1. Run the Apache2 installation file you download, install Apache, you will be prompted to enter the host name, administrator mailbox, etc. during the installation process, which can be modified after you installed, so you can reassure. When selecting the installation path, the author suggests that you also select the installation path to the root directory of the C disk. After step by step "Next", you will find that apache is easy to install. Now look at the right side of your taskbar, there should be an icon similar to this small icon, this is the Apache2 service manager, and the Apache1.x version is not available. Pay attention to the status of this picture, if there is a green small triangle, indicating that your server has been installed successfully, if it is red, then your apache is not installed, you need to further find the root of failure. Generally, the most common mistake is that the port has conflicts, and the Apache default port is 80. If your 80-port is occupied by another program (such as IIS), it will appear unable to start. In this case, you can modify it in the following method: Click "Start -> Program -> Apache Http Server 2.0.40-> configure apache server-> edit the apache httpd.conf configuration file" opens an Apache configuration File, you can use a text editor to open it. Then in the 120th line of this file, you will find a word similar to "Listen 80". Now just change this 80 to the port you want, you don't forget to add port when you browse it. Here, your apache should have lit the green light. Let's test whether it is working. Open your browser, type "http:// localhost /" on the address bar (if your port is not 80, you need to add ": port number" after you "), don't know if you see the welcome page of Apache, The author did not see this step. I don't know what, the Apache2 version seems to have no default boot page. If you haven't seen it, you can try to add a file name "index.html.en", if you can appear on the following page, the Apache has been working properly. 2. Ok, Apache has installed OK, then look at how to combine with PHP. The first two steps and the IIS steps introduced on the top are the same, and it is also decompressed to the C-plate root directory, then rename, copy the php.ini to the system folder. If necessary, modify "extension_dir" and "DOC_ROOT" two values. It is already very clear on the top, no more. Then it is the most important step, and it is also the core step of modular installation, you can look at it. Open the Apache2 profile (http.conf), you can open by clicking "Start -> Program -> Apache Http Server-> Edit The Apache Httpd.conf Configuration File".

Or open the confed directory in your apache installation directory, you will find a file called http.conf, it is it, you can use any text editor to open it. On the 121st line of this file, you should find the word "loadModule", then the back is a cyan path, this is the module to be loaded by Apache, and we can also add a sentence, let him come. Load the PHP module. In fact, it is so simple, you just have to add such a "loadModule PHP4_Module C: /PHP/SAPI/php4apache2.dll", here to explain "PHP4_Module" is the name of the module, the path behind the back, follow your PHP installation directory And the three strings are separated by spaces. Next, there is another step in work, but also a lot of mounting failed friends ignored, just starting the author, the Apache will not start after the case of adding it. After several tests, I found that "php4ts.dll" in your PHP installation directory must be copied to the system32 directory of the Windows system, otherwise it is impossible to start. Now try again, is it everything is normal. Ok, let's review the process we installed under Apache. (1) Add "LoadModule PHP4_Module C: /PHP/SAPI/php4apache2.dll". (2) Copy "PHP4Ts.dll" to the System32 directory. Yes, it is as simple, PHP has run on your machine. You can see this by double-clicking on the Apache server icon of the taskbar. The following figure shows the comparison of the PHP module and the unloaded PHP module:

3. Test it again. Save the following code into info.php files in the HTDOCS directory in your apache installation directory. Then tapping http://localhost/info.php in the browser (if your port is not 80, please add ": port number" after localhost / after), is it looking? It is displayed in the following screen. If so, congratulations, you have successfully installed PHP in a modular manner, and note that the figure indicated below the screenshot after the CGI module installed under IIS.

The above in the Apache section may not understand some friends who are not familiar with apache, but as long as you follow the steps mentioned above, there should be no big problems. If you don't know which part you change, you can't start, you can switch to the conf folder in the Apache installation directory, delete the http.conf file, and then the Apache's default configuration file httpd.default. CONF is renamed into http.conf. If you want to learn more about Apache configuration, you can refer to another article on this site "Apache Server Configuration Raiders" (http://www.hooday.com/?n=ReadArticle&a=94).

Fourth, after the installation of PHP is a very simple thing, especially the process of installing PHP in modular installation. Everyone has time to try it, so you can experience the joy of success. Finally, I wish you all a smooth installation of PHP. : P

转载请注明原文地址:https://www.9cbs.com/read-25980.html

New Post(0)