In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail how to configure PHP for you. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
Apache 2 can run PHP programs in two ways: through a CGI interface (calling Php.exe externally), or using PHP's DLL file to run inside Apache. The speed of the latter is faster. Therefore, two Windows binary distributions are provided for each version of PHP. The smaller is the .msi package, which installs the CGI executable Php.exe, but removes the modules needed to run PHP scripts through Apache DLL. The larger .zip package contains all of these things, which you can download from the Win32 section of the snaps.php.net website. When the file is downloaded, extract it to C:\ Php (keep the folder name). Unless you are absolutely sure, please also download the PHP manual, which is available in multiple languages.
PHP configuration
Now comes the most interesting part: the combination of Apache and PHP***. First, copy all the DLL files in the C:\ Php\ Dlls directory to the Windows's System directory (% windir%\ System). Next, look for the section in Apache's configuration file (Httpd.conf) that contains a large number of AddType commands, and add the following line yourself:
AddType application/x-httpd-php .php
Copy C:\ Php\ Php.ini-recommended to the Windows directory (% windir%), rename it to Php.ini, and open it with a text editor. Edit the three lines where you set up doc_root, extension_dir, and session.save_path to make them the same as shown below, and be sure to replace InstallDir with the name of your Apache 2 installation directory.
Doc_root = c:\ apache\ apache2\ htdocs extension_dir = c:\ php\ extensions session.save_path = c:/temp
The use of forward slashes and backslashes is allowed in session.save_path. The PHP configuration claims that these path parameters need to add a backslash to *, but this is not true. This is not required in PHP 4.3. In addition, if C:\ Temp does not exist, create it yourself.
The next step is to allow Apache to run the PHP program as a module, which requires you to take two steps. First, copy C:\ Php\ Php4ts.dll to the system folder of Windows (% windir%\ System). Find the LoadModule section in Httpd.conf and add the following line yourself:
LoadModule php4_module "c:/php/php4apache2.dll"
If for some reason you need to run the PHP program in CGI mode (using Php.exe), turn the above line into a comment and add the following lines to Httpd.conf:
ScriptAlias / php/ "c:/php/" Action application/x-httpd-php "/ php/php.exe"
Is everything taken care of?
After saving your changes, you need to prove two points yourself to ensure that Apache 2/PHP 4 is a pair of partners: does Apache load properly, and does it handle PHP pages correctly?
To see if Apache can load properly, type the following command in the command line window that you have opened:
Apache-k start
Also, if Apache is running, restart it with the following command:
Apache-k restart
The advantage of starting Apache from the command line is that if an error occurs, Apache reports it immediately. The most common problem you may encounter is that Apache may not be able to load Php4apache2.dll for some reason. If Apache reports this error, follow the steps described earlier to make sure nothing goes wrong. To see if Apache can handle PHP pages correctly, use your text editor to create a simple PHP page named Phptest.php that contains only the following line:
Save the file to the main Web server directory (C:\ InstallDirectory\ Apache\ Apache2\ Htdocs) and access http://localhost/phptest.php with a browser. If all goes well, you should see a web page with a PHP logo that contains a lot of settings and other information. To know whether PHP is currently running through CGI or inside Apache, check the environment variable orig_script_name. If PHP runs through CGI, the value of this variable is / Php/Php.exe. If Apache runs the PHP script as a module, the value of this variable should be / Phptest.php.
This is the end of the article on "how to configure PHP". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
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: 257
*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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.