: HOWTOPhpFastCGI

Welcome :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register
Most recent edit on 2008-01-08 17:36:10 by AndrewBoring

Additions:
AddType application/x-httpd-php5 .php


Deletions:
Ad­dType application/x-httpd-php5 .php




Edited on 2007-08-29 16:52:10 by AndrewBoring

Additions:
%%Action application/x-httpd-php5 /php5.fcgi

Deletions:
%¬tion application/x-httpd-php5 /php5.fcgi



Edited on 2007-08-29 16:51:45 by AndrewBoring

Additions:
Ad­dType application/x-httpd-php5 .php


Deletions:
%­dType application/x-httpd-php5 .php%%



Edited on 2007-08-28 02:21:13 by Wf3Zqi

Additions:
%­dType application/x-httpd-php5 .php%%
%¬tion application/x-httpd-php5 /php5.fcgi


Deletions:
AddType application/x-httpd-php5 .php

%%Action application/x-httpd-php5 /php5.fcgi




Edited on 2007-08-09 12:34:21 by TimDorr

Additions:
- See also the PHP wiki page

Deletions:
- See also the PHP Wiki



Edited on 2007-08-09 12:33:58 by TimDorr

Additions:
- The php5.fcgi file MUST contain only UNIX type line endings otherwise this won't work.

Deletions:
- The php5.fcgi file MUST contain only UNIX type line endings otherwise this won't work. Until this Wiki is updated, read the forum thread for more information.



Edited on 2007-07-12 11:09:34 by AndrewBoring

Additions:
Link to server's default php.ini for php5:
INFOphpini




Edited on 2007-07-12 11:07:38 by AndrewBoring

Additions:
That will point to a php.ini file in your home directory that you can set up with whatever options you'd like. We have used the default php.ini-dist file for the copies of PHP5 on all the servers, so you can use this php.ini file to start with. Feel free to make any configuration changes you like, but remember to consider the fact that you're on a server with other users. Do your best to disable any potential security-related settings (like register_globals) or performance-related settings (like MySQL persistent connections).

Deletions:
That will point to a php.ini file in your home directory that you can set up with whatever options you'd like. We have used the default php.ini-dist file for the copies of PHP5 on all the servers, so you can use the file from php.net to go on. Feel free to make any configuration changes you like, but remember to consider the fact that you're on a server with other users. Do your best to disable any potential security-related settings (like register_globals) or performance-related settings (like MySQL persistent connections).



Edited on 2007-05-03 13:02:54 by AndrewBoring

Additions:
- If you use the custom php5.fcgi in the ~/public_html directory for your primary domain, you *must enable this for all your addon domains and place the php5.fcgi and .htaccess files for all your Addon Domains



Edited on 2007-04-03 13:33:14 by AndrewBoring

Additions:
That's it. All your php scripts now run under PHP 5.

Deletions:
That's it.



Edited on 2007-02-06 14:54:40 by AndrewBoring [custom php.ini title for quick and easy skimming]

Additions:

Custom php.ini





Edited on 2007-01-24 18:14:03 by AndrewBoring

Additions:
However, if you need to customize parameters (such as upload_max_filesize, memory_limit), you won't be able to enable those through .htaccess (like you would with php4) and you won't be able to edit the server's php.ini file. So to customize php5 for your specific site, you'll need to be sure you .htaccess contains both of these lines:

Deletions:
However, if you need to customize parameters (such as max_upload, memory_limit), you won't be able to enable those through .htaccess (like you would with php5) and you won't be able to edit the server's php.ini file. So to customize php5 for your specific site, you'll need to be sure you .htaccess contains both of these lines:



Edited on 2007-01-23 11:12:43 by AndrewBoring

Additions:

How to Use PHP 5





Edited on 2007-01-23 10:55:03 by AndrewBoring [added Easier php5 for completeness]

Additions:
The following text was taken (and edited) from the following forum posts:

The Quick and Easy Way

Simply add this line to your .htaccess file:
AddType application/x-httpd-php5 .php

That's it.

The More Involved and Customizable Method

However, if you need to customize parameters (such as max_upload, memory_limit), you won't be able to enable those through .htaccess (like you would with php5) and you won't be able to edit the server's php.ini file. So to customize php5 for your specific site, you'll need to be sure you .htaccess contains both of these lines:
Action  application/x-httpd-php5 /php5.fcgi
AddType application/x-httpd-php5 .php

And you'll need to use the custom php5.fcgi script below.


Deletions:
The following text was taken (and edited) from the following forum post:

Yes, finally! There's just a bit of a trick to getting it running, but it's available and running side-by-side with PHP4. By default, we're still going to use mod_php4 on all our servers as the default, but those who need or want PHP5 will have the option to do so.




Edited on 2006-05-11 19:10:44 by PhilOlson [link to PHP wiki]

Additions:
- See also the PHP Wiki



Edited on 2006-05-10 15:46:47 by BjStrange

Additions:
First, create a file in your public_html directory called php5.fcgi. If this is a subdomain put the file in the subfolder for the site instead of public_html. This script will be called whenever there is a request to a .php5 page and there are no active FastCGI PHP processes running. You will need to CHMOD this script as 755 to ensure it functions properly. In it, you'll want to put this:

Deletions:
First, create a file in your public_html directory called php5.fcgi This script will be called whenever there is a request to a .php5 page and there are no active FastCGI PHP processes running. You will need to CHMOD this script as 755 to ensure it functions properly. In it, you'll want to put this:



Oldest known version of this page was edited on 2006-05-10 04:06:37 by PhilOlson [initial commit]
Page view:
The following text was taken (and edited) from the following forum post:
ASO Forum thread titled: PHP5 is now available


Yes, finally! There's just a bit of a trick to getting it running, but it's available and running side-by-side with PHP4. By default, we're still going to use mod_php4 on all our servers as the default, but those who need or want PHP5 will have the option to do so.

How It Works


We've added PHP5 running through FastCGI. It's like a CGI, except fast, as the name implies. The short of it is that your PHP5 interpreter stays running even after the request for a page has been completed. Unlike CGI, this means you don't have to incur the expensive task of starting up PHP from scratch on every page load.

Every server has a separate copy of PHP5 installed at /usr/local/php5-fcgi/ that is compiled with FastCGI support. Just like you do with Ruby, you need a way to hook that up to execute when a .php5 file is hit. To make things easy, we've added a default configuration in Apache to all the servers that runs all .php5 files through a shell script. In reality, you can have that script do whatever you want, but ideally it will just call over to the PHP5 binary and get the party started.

Using PHP5


First, create a file in your public_html directory called php5.fcgi This script will be called whenever there is a request to a .php5 page and there are no active FastCGI PHP processes running. You will need to CHMOD this script as 755 to ensure it functions properly. In it, you'll want to put this:

#!/bin/sh
PHP_FCGI_CHILDREN=2
export PHP_FCGI_CHILDREN
PHP_FCGI_MAX_REQUESTS=500
export PHP_FCGI_MAX_REQUESTS
exec /usr/local/php5-fcgi/bin/php


That's all there is to it. What is that script doing? Well, it sets some basic FastCGI-related environmental variables to ensure that you don't have a ton of FastCGI processes starting up and that they are killed off after 500 requests to protect against memory leaks. Please don't increase these values as they could lead to unstable operation of your server. Be a good neighbor!

Since you're free to make some changes to this script, you can also set it up to run your own php.ini file. You can change the last line to this:
exec /usr/local/php5-fcgi/bin/php -c /home/username/php.ini


That will point to a php.ini file in your home directory that you can set up with whatever options you'd like. We have used the default php.ini-dist file for the copies of PHP5 on all the servers, so you can use the file from php.net to go on. Feel free to make any configuration changes you like, but remember to consider the fact that you're on a server with other users. Do your best to disable any potential security-related settings (like register_globals) or performance-related settings (like MySQL persistent connections).

So, go and enjoy all the new features and changes that PHP5 has to offer.

Notes and Considerations


Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by Wikka Wakka Wiki 1.1.6.2
Page was generated in 0.1124 seconds