summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Mansell <joosters@php.net>2002-03-11 14:34:56 +0000
committerBen Mansell <joosters@php.net>2002-03-11 14:34:56 +0000
commit889988763f48858f06db1ccb715c6b0938f66d71 (patch)
tree350e722c5a2eab109f2538e622213bb3a9ff7bfe
parent8154dbb7a229f553ebf83723bb0608d35e147ae3 (diff)
downloadphp-git-889988763f48858f06db1ccb715c6b0938f66d71.tar.gz
Instructions for using FastCGI-PHP with Apache
-rw-r--r--sapi/fastcgi/README.Apache53
1 files changed, 53 insertions, 0 deletions
diff --git a/sapi/fastcgi/README.Apache b/sapi/fastcgi/README.Apache
new file mode 100644
index 0000000000..c7a2172580
--- /dev/null
+++ b/sapi/fastcgi/README.Apache
@@ -0,0 +1,53 @@
+Using FastCGI PHP with Apache
+=============================
+
+First of all, you may well ask 'Why?'. After all, Apache already has mod_php.
+However, there are advantages to running PHP with FastCGI. Separating the
+PHP code from the web server removes 'bloat' from the main server, and should
+improve the performance of non-PHP requests. Secondly, having one permanent
+PHP process as opposed to one per apache process means that shared resources
+like persistent database connections are used more efficiently.
+
+First of all, make sure that the FastCGI module is enabled. You should have
+a line in your config like:
+
+ LoadModule fastcgi_module /usr/lib/apache/1.3/mod_fastcgi.so
+
+Don't load mod_php, by the way. Make sure it is commented out!
+
+ #LoadModule php4_module /usr/lib/apache/1.3/libphp4.so
+
+Now, we'll create a fcgi-bin directory, just like you would do with normal
+CGI scripts. You'll need to create a directory somewhere to store your
+FastCGI binaries. We'll use /space/fcgi-bin/ for this example. Remember to
+copy the FastCGI-PHP binary in there. (named just 'php')
+
+ ScriptAlias /fcgi-bin/ /space/fcgi-bin/
+ <Location /fcgi-bin/>
+ SetHandler fastcgi-script
+ </Location>
+
+Next, we need to tell Apache to use the FastCGI binary /fcgi-bin/php to
+deliver PHP pages. All that is needed is:
+
+ AddType application/x-httpd-php .php
+ Action application/x-httpd-php /fcgi-bin/php
+
+Now, if you restart Apache, php pages should now be delivered!
+
+
+Running PHP-FastCGI separately from the webserver
+-------------------------------------------------
+
+(Read README.FastCGI for why you might want to do this).
+Easy! Add one more configuration line:
+
+ FastCgiExternalServer /space/fcgi-bin/php -host localhost:8002
+
+Then, start the PHP off with the following command:
+
+ /space/fcgi-bin/php 8002
+
+The number 8002 is the port that PHP will listen on for requests - change this
+to anything suitable. And be sure to firewall it out so that external
+connections are denied!