Running PHP In FastCGI mode in Apache 1.3 in Windows

Source: Internet
Author: User

I have been running php in ISAPI mode for a long time (as the mainstream development language). The biggest drawback of this method is poor stability. When php (as the mainstream development language) when an error occurs, the apache (the most popular WEB server platform on the Unix platform) process also dies. Later, I saw an introduction about how to run php (as the mainstream development language) in Fastcgi (not many people are using it now) mode on the Internet, the advantages mentioned in this article (stability, security, and high performance) let me decide to try it.

However, things are far less smooth than expected. Google hasn't found an article on how to use apache (the most popular WEB server platform on Unix) + Fastcgi in Windows (not many people are using it now) run php (as the mainstream development language) materials, iis (Microsoft's WEB server platform) + Fastcgi (not many people are using it now) there are quite a few running php (as the mainstream development language. One article mentioned that Zend also recommends using Fastcgi (not many people are using it now) to run php (as the mainstream development language) (http: // php (as the mainstream development language) lens.com/php (as the mainstream development language) everywhere/fastcgi (not many people are using it now) -php (as the mainstream development language )).

After several hours of exploration, we finally succeeded in implementing apache (the most popular WEB server platform on Unix) 1.3 + Fastcgi (not many people are using it now) run php (as the mainstream development language ).

Preparations:
First visit http://www.fastcgi (now not many people are using ). com/dist/download mod_fastcgi for apache (the most popular WEB server platform on the Unix platform) (not many people are using it now ). I am using mod_fastcgi (not many people are using it now)-2.4.2-AP13.dll. Copy the downloaded file to the modules directory of apache (the most popular WEB server platform on the Unix platform.

Download php (as the current mainstream development language) (My php (as the current mainstream development language)-5.0.4), decompress, modify php as needed (as the mainstream development language ). ini file. Note that you do not need to copy any files from the directory where php (as the current mainstream development language) is located to the Windows directory.

Modify Configuration:
Modify the httpd. conf file and add the following lines:

LoadModule fastcgi (not many people are using it now) _ module modules/mod_fastcgi (not many people are using it now)-2.4.2-AP13.dll
ScriptAlias/fcgi (not many people are using it now)-php (as the mainstream development language) 5/"d: /usr/local/php (as the mainstream development language)-5.0.4 /"
Fastcgi (not many people are using it now) Server "d:/usr/local/php (as the current mainstream development language)-5.0.4/php (now the development language development -cgi(now few people are using cmd.exe"-processes 3
# Note: here "-processes 3" indicates that three PHP scripts are started (the current development language "example-cgi(currently, many users are using the cmd.exe process,
# For detailed Server parameters of Fastcgi (not many people are using it now), see Fastcgi (not many people are using it now.
AddType application/x-httpd-fastphp (as the mainstream development language) 5. php (as the mainstream development language)
Action application/x-httpd-fastphp (as the mainstream development language) 5 "/fcgi (not many people are using it now)-php (as the mainstream development language) 5/PHP (for the current development language ‑cgi(now few people are using cmd.exe"
# Note: Modify the above two italics based on the location of your php (as the current mainstream development language) file.

After the modification, restart apache (the most popular WEB server platform on the Unix platform.

FAQs:
According to my many experiments, the most common problems are caused by paths. Therefore, first check whether all the paths in php (as the mainstream development language). ini and httpd. conf files are correct. Second, if php has been installed in the system before (as the mainstream development language), you need to rename or delete C: Windowsphp (as the mainstream development language). ini.

Second, check whether the directory of the php (as the current mainstream development language) file has sufficient permissions (I set it to Everyone-full control, in any case, developers do not have to consider so many security restrictions ).

Fastcgi (not many people are using it now) mode to run php (as the mainstream development language) Advantages:
Using Fastcgi (not many people are using it now) mode to run php (as the mainstream development language) has several major advantages. First, apache (the most popular WEB server platform for Unix) will not be broken when php (as the mainstream development language) fails, but php (as the mainstream development language) if your process crashes (but Fastcgi (not many people are using it now), it will immediately restart a new php (as the mainstream development language) process to replace the failed process ). Secondly, Fastcgi (not many people are using it now) runs php (as the mainstream development language) it has better performance than the ISAPI mode (I used apache (the most popular WEB server platform on Unix) ghost for testing, but forgot to save the results. If you are interested, you can test it on your own ).

Finally, php (as the mainstream development language) 5 and php (as the mainstream development language) 4 can be run simultaneously. Refer to the following configuration file to create two virtual hosts, one using php (as the mainstream development language) 5 and the other using php (as the mainstream development language) 4.

LoadModule fastcgi (not many people are using it now) _ module modules/mod_fastcgi (not many people are using it now)-2.4.2-AP13.dll

ScriptAlias/fcgi (not many people are using it now)-php (as the mainstream development language) 5/"d: /usr/local/php (as the mainstream development language)-5.0.4 /"
Fastcgi (not many people are using it now) Server "d:/usr/local/php (as the current mainstream development language)-5.0.4/php (now the development language development -cgi(now few people are using cmd.exe"-processes 3
ScriptAlias/fcgi (not many people are using it now)-php (as the mainstream development language) 4/"d: /usr/local/php (as the mainstream development language)-4.3.11 /"
Fastcgi (not many people are using it now) Server "d:/usr/local/php (as the mainstream development language)-4.3.11/php (as the current development language cmd.exe"

Listen 80
NameVirtualHost *: 80

DocumentRoot d:/www
Options Indexes FollowSymlinks MultiViews
ServerName php (as the mainstream development language) 5. localhost

AddType application/x-httpd-fastphp (as the mainstream development language) 5. php (as the mainstream development language)
Action application/x-httpd-fastphp (as the mainstream development language) 5 "/fcgi (not many people are using it now)-php (as the mainstream development language) 5/PHP (for the current development language ‑cgi(now few people are using cmd.exe"


IndexOptions FancyIndexing FoldersFirst
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow, deny
Allow from all

 

Listen 8080.
Namevirtualhost*: 8080


DocumentRoot d:/www
Options Indexes FollowSymlinks MultiViews
ServerName php

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.