# Solved: .htaccess Script



## pcpro17 (Oct 9, 2006)

Can someone please explain to me what the commented out lines in this script are doing?


```
# This is telling Apache to use PHP installed at ~/php5
#Options +ExecCGI
#AddHandler fastcgi-script fcg fcgi fpl
#AddHandler php5-fastcgi .php
#Action php5-fastcgi /php5/php5-wrapper.fcgi
Options +ExecCGI
AddHandler php5-cgi .php
Action php5-cgi /php5/php5.cgi
```
Thanks!


----------



## tomdkat (May 6, 2006)

Looks like it's enabling CGI execution of PHP in a FastCGI environment.

The "AddHandler" entries associate file extentions with the FastCGI environment.

The "Action" entry defines which CGI script to invoke when the specified handler is encountered. In this case, files with a .php extension will be handled by "php5-fastcgi" and the process of "handling" those .php files will invoke the php5-wrapper.fcgi script.

FastCGI is recommended for use by those wanting to use PHP with a multi-threaded Apache multi-processing module (MPM). Since Apache on Windows is multi-threaded (along with just about everything else that will run on a Windows-based web server), FastCGI won't be needed. However, if the "worker" or another multi-threaded MPM is used in a Unix-hosted Apache environment, FastCGI is needed for PHP support since the various third party apps and/or libraries PHP supports aren't guaranteed to be thread safe even though PHP itself is (or I think it is).

FastCGI runs PHP in a CGI environment in a multi-threaded Apache on Unix web server environment to ensure stablity of the web server and PHP environments.

Peace...


----------



## MMJ (Oct 15, 2006)

The hash/pound sign means a comment.


----------



## tomdkat (May 6, 2006)

MMJ said:


> The hash/pound sign means a comment.


It's also how Obama shakes hands with Biden.  LOL

Peace...


----------



## pcpro17 (Oct 9, 2006)

So, if I enable fast CGI on my domain, I can switch this script to the following and it should work okay, then?

```
# This is telling Apache to use PHP installed at ~/php5
Options +ExecCGI
AddHandler fastcgi-script fcg fcgi fpl
AddHandler php5-fastcgi .php
Action php5-fastcgi /php5/php5-wrapper.fcgi
#Options +ExecCGI
#AddHandler php5-cgi .php
#Action php5-cgi /php5/php5.cgi
```


----------



## tomdkat (May 6, 2006)

pcpro17 said:


> So, if I enable fast CGI on my domain, I can switch this script to the following and it should work okay, then?


No, you should first learn about and understand what FastCGI is, does, and what the ramifications of using it are. You should find out if it's even needed in your web server environment and determine why you're wanting to use it if it's not needed. You should find out the side effects, if any, of using it if you're hosting provider is NOT running a multi-threaded web server on Unix/Linux with a PHP environment.

Lastly, if your hosting provider is running a multi-threaded web server on Unix/Linux with a PHP environment, they should be already running PHP in a FastCGI (or similar) kind of environment. Find out if they support FastCGI and see if they have FastCGI installed, etc.

This isn't the kind of thing where you "just enable it" and things "just work". If you don't understand what's going on, you'll have a tough time figuring out what is wrong if something doesn't work. Is it FastCGI? Is it PHP? Is it an web server/FastCGI interaction issue? And so on.

Once you've got that figured out, you'll be able to answer your own question. 

Peace...


----------



## MMJ (Oct 15, 2006)

tomdkat said:


> It's also how Obama shakes hands with Biden.  LOL
> 
> Peace...


rofl.


----------



## pcpro17 (Oct 9, 2006)

Thanks, Tom. I'll go though my domain settings an disable FastCGI until I have a need for it.


----------

