Re: PHP and a general problem understanding fastcgi

Benjamin Podszun <ben-/[email protected]>
Newsgroups gmane.comp.web.fastcgi.devel
Message-ID <[email protected]>
David Birnbaum wrote:
> On Wed, 13 Jul 2005, Benjamin Podszun wrote:
> 
>> First of all: Thanks for your patience and support. I hope this (and 
>> the resulting FAQ entry) helps others as well.
> 
> 
> No problem...
> 
>>>> Thanks for your comments here. I thought I understand what you mean 
>>>> and tried the following:
>>>>
>>>> FastCgiServer /var/www/default/php/php -user web-default -group 
>>>> web-users -socket default
>>>
>>>
>>> This should be out of scope of the vhost - but map to the vhost.
>>>
>>> So, set up the VHost something like this:
>>>
>>>   <VirtualHost 1.2.3.4:80>
>>>     DocumentRoot /var/www/1.2.34
>>>     User blah
>>>     Group blahgrp
>>>
>>>     <Location /php/php>
>>>       SetHandler fastcgi-script
>>>     </Location>
>>>     Action php-fastcgi /php/php
>>>   </VirtualHost>
>>>
>>> So this sets up FastCGI properly for Dynamic mode, I think (although 
>>> you probably need to enable FastCgiWrapper.  If you want a static 
>>> server, then you put this OUT of scope (because it's server wide):
>>>
>>>   FastCgiServer /var/www/1.2.3.4/php/php -user web-default -group 
>>> web-users
>>>
>>> which will create the instance.  You can then multiply these like so:
>>>
>>>   FastCgiServer /var/www/blah.com/php/php -user blah -group blahgrp
>>>   FastCgiServer /var/www/foo.com/php/php -user foo -group foogrp
>>>
>>> And they will work, as long as php/php is set up as a php-fastcgi 
>>> action within the relevant vhosts (blah.com, foo.com).  If you want 
>>> only ONE server, then change things like so:
>>>
>>>   FastCgiServer /var/www/1.2.3.4/php/php -user web-default -group 
>>> web-users -port 9050
>>>   FastCgiExternalServer /var/www/blah.com/php/php -host localhost:9050
>>>   FastCgiExternalServer /var/www/foo.com/php/php -host localhost:9050
>>>
>>> which will have one "real" instance and two "fake" instances that are 
>>> handled internally.
>>
>>
>> Okay - I tried to map this instructions to my setup, but I still get 
>> the error:
>>
>> The requested URL /fast-cgi/default/php/test/index.php was not found 
>> on this server.
> 
> 
> That's the clue - see below:
> 
>> My setup:
>>
>> General config:
>>
>> FastCgiWrapper On
>> FastCgiIpcDir /tmp/fastcgi
>> FastCgiServer /var/www/default/php/php -user web-default -group 
>> web-users -socket default
>> FastCgiExternalServer /fast-cgi/default/php -user web-default -group 
>> web-users -socket default
>>
>> I want a single default php instance and share that for default 
>> hosts/applications. I read those lines above as "create a static 
>> server of '/var/www/default/php/php' with the given user and group and 
>> connect a virtual application '/fast-cgi/default/php' to this 
>> instance". Right so far?
> 
> 
> Not quite - the FastCgi*Server directives are all absolute pathnames, 
> NOT relative to the DocumentDir.  So, you actually need to change the 
> FastCgiExternalServer directive to be absolute, which then overlaps to 
> the RELATIVE path that your Location/Action is.  It's a bit confusing 
> that the Location/Action is relative, but the Server directives are 
> absolute.

Sorry for wasting your time here.
Uhm, yes - that's really a little bit confusing. Thanks for the 
explanation though.

>> In my vhost I'm having this:
>>
>> AddHandler php-fastcgi .php
>> <Location /fast-cgi/default/php>
>>  SetHandler fastcgi-script
>> </Location>
>> Action php-fastcgi /fast-cgi/default/php
>>
>> Which I read as "Add a handler called 'php-fastcgi' for files ending 
>> with '.php', handle all requests to the location 
>> '/fast-cgi/default/php' as fastcgi script and call 
>> '/fast-cgi/default/php' for every request of the php-fastcgi handler.. 
>> Wouldn't that do what I want?
> 
> 
> Yes, but you haven't actually mapped the relative path 
> /fast-cgi/default/php to a server....  I'm guessing that you should 
> change your FastCgiExternalServer to this:
> 
>   FastCgiExternalServer /var/www/[your docroot]/fast-cgi/default/php 
> -socket default

Done. It's now (pasted):

FastCgiExternalServer /var/www/default/webroot-ssl/fast-cgi/default/php 
-user web-default -group web-users -socket default

>>> Well, we'll work on that  ;)  Dang it, I wrote that FAQ entry a few 
>>> years ago and haven't looked at it since!
>>
>>
>> Wee.. ;) Well, I guess it could need some love. I really do like 
>> reading documentation, so this is not about being to lazy to search or 
>> something like that. It's just quite hard to figure it out being 
>> completely on your own..
>>
>> Thanks again for your response/help,
> 
> 
> Let's see if that fixes it....

Sorry.. Exactly the same error message.. :-/

Ben
___________________________________
fastcgi-developers mailing list
http://fastcgi.com/fastcgi-developers/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.