Home  >  Article  >  Backend Development  >  Configure php and cgi server with ApacheServer_PHP tutorial

Configure php and cgi server with ApacheServer_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:30:40858browse

Author: coolfire Nowadays, more and more personal homepage webmasters need to know how to configure their own PHP and CGI servers under Windows systems to facilitate local debugging of CGI and PHP programs. We can use Apache (windows version) to do it all at once: The following articles are compiled by myself about the installation and configuration of Apache Server in a stand-alone Windows environment. If you are testing your website in a Windows stand-alone environment, it is recommended that you refer to it. Mainly includes: installing and configuring Apache Server; using Perl CGI scripts; using PHP scripts. --Refer to "Apache Server System Administrator's Manual" for some content. 1. Installation under Windows Of course, you must first have the Apache installation program. You might as well go to http://www.apache.org/dist to have a look. Here is a list of Apache mirror sites worldwide to find the one closest to you. If you are in China, I suggest you go to the software house to have a look. The general file name of A pache's installation program is apache_1_3_x.win32.exe. Put it into your machine and run it. The installation program will prompt you to modify the default directory location of Apache installation C:Program FilesApache GroupApache. In order to facilitate future configuration and maintenance, it is recommended that you install it in the root directory, such as C: Apache. After that, you will be prompted to select the installation type. It is recommended that you select Custom so that you will know what is installed. Specific projects include Application File, Source Code, Apache Manual, Additional Modules, Icons, and Repuired Directories. You can decide how to install it based on your situation. If all goes well (there should be no problems at this point), the installation will be completed shortly. Apache will automatically complete some basic configurations. You can use UltraEdit-32 (or other text editing software) to open the c onfhttpd.conf file to get a rough idea. 2. Configure Apache Server The first thing to do here is the basic configuration so that your Apache Server can run as you wish. Use UltraEdit-32 (or other text editing software) to open the confhttpd.conf file. 1. Find ServerName. Define your domain name here. In this way, when Apache Server is running, you can access your site in the browser. If there is a # in front of it, remember to delete it. This is the comment mark of conf. 2. Find ServerAdmin. Enter your email address here. If you only use it on a single computer, it doesn't matter whether you change it or not. 3. Find. There is a sentence Options at the bottom, remove all the following parameters, and add an All (note that it is case-sensitive! The same below.); then there is a sentence Allow Override, also remove all the following parameters, and add an All. 4. Find DocumentRoot. This statement specifies the path of your website, which is the directory where your homepage is placed. You can use the default one, or you can specify one yourself, but remember, do not put "/" at the end of this sentence. Also note that the "" of the directory is written as "/" in Apache Server. 5. Find the DirectoryIndex. This is The first displayed homepage of your site. After changing these, you can start Apache Server. If not, follow the above steps to modify it carefully. 3. Add support for Perl CGI scripts. To enable your Apache Server to support CGI scripts, you must first install Perl for Win32. The installation process is not described in detail. It is assumed that Perl is installed in the C:Perl directory. 1. Find the ScriptAlias ​​file. /cgi-bin/ "C:/Apache/cgi-bin/". Delete the # in front and point the path in "" to the directory where you store the CGI script. That is, the CGI script in this directory can be executed. 2. , find it. Point the path in "" to the directory where you store the CGI script. Change the parameters of Options and Allow Override to All. 3. Find AddHandler cgi-script.cgi and delete it. Add .pl at the end. Note: The Perl interpretation path in the CGI script is changed to: #!C:perl inperl. Otherwise, a 500 error will occur. 4. Add support for PHP scripts. You also need to install PHP here. Windows version. Assume it is installed in the C:php directory. Add: ScriptAlias ​​/php/ "c:/php/" to the httpd.conf file. AddType application/x-httpd-php3 .php3 .php .phtml Action application/x -httpd-php3 "/php/php.exe" Your PHP script can be placed anywhere on the site (except cgi-bin). At this point, your Apache Server can support both CGI and PHP. That's good. Go ahead. Good luck!

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/509167.htmlTechArticleAuthor: coolfire Now more and more personal homepage webmasters need to know how to configure themselves under the windows system PHP, CGI server to facilitate local debugging of CGI and PHP programs. We...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn