Reposted: PHP4.23 Install instances on the IIS and Apache2 servers under WindowsXP

xiaoxiao2021-03-06  55

?

? Reposted: PHP4.23 Install instances on the two servers in the IIS and Apache2 in WindowsXP recently, many friends have a friend asked me to install the PHP under WindowsXP, just recently, I have successfully modularly in my own machine. The PHP4.23 is installed. 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. First, overview: • In installation, you must first understand 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. II. Software Preparation:? The so-called "Workers must have a good thing to make a tool". If you want to run PHP on your machine, you must first prepare the software you need. (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 want everyone to 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. 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.phpe.net) Downloadclics Download the author used in this article (Apache2.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, the latest version of PHP is 4.23, the size is 5,417kb. Of course, you can also download them in the download section of this site. ? All right. Software is ready, let's start our PHP installation journey :)? Note: The following installation is based on PHP4.23, Apache 2.040. 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. 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 into "php.ini", then copy it to In the system catalog (if your system is installed in the C drive, XP is "c: windows", and Windows 2000 is "C: Winnt"). Previously, there have been many articles that introduce the PHP installation files to modify "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 These 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 "Home" tab, as shown below: • Click the "Configure" 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, the absolute path in which your php.exe is located, add "% s% s", here is "c: phpphp.exe% s% s ", the extension name text box writes the suffix name you require PHP program processing, where we write" .php ", the options below are 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: Security Alert! The PHP CGI Cannot 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, eg via an Apache Action directive.For more information as to why this behaviour exists, see the manual page for CGI security.For more information about changing this behaviour or re-enabling this WEBSERVER, CONSULT The Installation File That Came with this distribution, or visit the manual page. 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, Apache installation: Our use of Apache's new version apache2, I used to install PHP in Apache, remember to be more trouble, now under Apache2 platform, we can conveniently modular The way PHP is installed, provided that the PHP version must be 4.0 or more. 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.phpe.net/?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 Apache2 profile (http.conf), you can open by clicking "Start ->" -> Apache Http Server-> Edit The Apache Httpd.conf Configuration File ", or open your Apache Install the confed directory in the directory, you will find a file called http.conf, it is it, you can use a 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 "AddType Application / X-httpd-PHP .PHP". (2) Add "LoadModule PHP4_Module C: /PHP/SAPI/php4apache2.dll". (3) Copy "PHP4TS.DLL" to the System32 directory. Yes It is so simple, PHP has been running on your machine. You can see this by double-clicking on the Apache server icon of the taskbar. The following figure is a 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. PHPINFO ();?> and then knocked in http://localhost/info.php in the browser (if your port is not 80, please add ": port number" after localhost / after ": port number"), is it similar to the following The screen is displayed. 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 mentioned in the Apache section may have a little unclear, 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, you can refer to another article on this site "Apache Server Configuration Raiders" (http://www.phpe.net/?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 Keep: Many friends say that they can't press the above method to properly install PHP, and this reason is due to the reason for PHP.

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

New Post(0)