lighttpd forum migration > Any way to do this?

Posted by Chris Hutzler
on 13.02.2006 02:57
In my apache configs I make use of the forcetype directives as follows:

<files archive>
                AcceptPathInfo On
                ForceType application/x-httpd-php
</files>




Is there any way to duplicate this functionality in lighttpd?, basically
I need the file 'archive' to be served as a .php


Also, is there ANY way to authenticate with digest based on groups? ie. 
with apache I use a 'require group admins' in my auth statements. I can 
add all users
vie the "require" => "user=xxx|user=xxxx|user=xxxxx" but it would be 
ALOT more effeciant for a "require" => "group=admin". I know it seems 
trivial, but I've got quite a few protected areas and different sets of 
users have different levels of access, being able to do this would make 
a WORLD of difference.

TIA!
Posted by Marc (Guest)
on 13.02.2006 22:24
I did not try, but this might work:

HTTP["url"] =~ "/archive" {
   mimetype.assign = ("" => "application/x-httpd-php" )
}


Chris Hutzler wrote:
> In my apache configs I make use of the forcetype directives as follows:
> 
> <files archive>
>                 AcceptPathInfo On
>                 ForceType application/x-httpd-php
> </files>
> 
> 
> 
> 
> Is there any way to duplicate this functionality in lighttpd?, basically
> I need the file 'archive' to be served as a .php
> 
> 
> Also, is there ANY way to authenticate with digest based on groups? ie. 
> with apache I use a 'require group admins' in my auth statements. I can 
> add all users
> vie the "require" => "user=xxx|user=xxxx|user=xxxxx" but it would be 
> ALOT more effeciant for a "require" => "group=admin". I know it seems 
> trivial, but I've got quite a few protected areas and different sets of 
> users have different levels of access, being able to do this would make 
> a WORLD of difference.
> 
> TIA!
Posted by Chris Hutzler
on 14.02.2006 13:29
Thanks! I'll give it a shot and let ya know.

Marc wrote:
> I did not try, but this might work:
> 
> HTTP["url"] =~ "/archive" {
>    mimetype.assign = ("" => "application/x-httpd-php" )
> }
> 
> 
Posted by Chris Hutzler
on 14.02.2006 13:38
Well, that seemed to get the file(s) assigned the proper mime type, but 
they're not being processed through php (ie when clicking on a link to 
'archive' firefox prompts to download or open with the file with the 
mime.type of application/x-httpd-php, but it's not parsed with php....

Gives me at least I've got a starting point...I'd REALLY love to get 
this working, as it's the last part of my apache configs that I've yet 
to be able to migrate...

Thanks again!
on 14.02.2006 14:50
Hi,

please use fastcgi.map-extensions, it works under 1.4.10
there is no need to use mimetype.assign


fastcgi.map-extensions = ( "/archive" => ".php" )

fastcgi.server = ( ".php" => ((
         "bin-path" => "/usr/bin/php-cgi",
         "socket" => "/tmp/php-fastcgi.sock-5-" + var.PID,
         "min-procs" => 1,
         "max-procs" => 1,
         "max-load-per-proc" => 3,
         "idle-timeout" => 60,
         "bin-environment" => (
             "PHP_FCGI_CHILDREN" => "50",
             "PHP_FCGI_MAX_REQUESTS" => "9999"
            ),
         "bin-copy-environment" => (
             "PATH", "SHELL", "USER"
            ),
         "broken-scriptfilename" => "enable"
    )))
Posted by Chris Hutzler
on 14.02.2006 15:38
excellant! thanks, that did it.....

Now that that's resolved another issue has come up. Is there something 
equal to apaches AcceptPathInfo directive to allow passing of trailing 
pathname info to a script ( 
http://httpd.apache.org/docs/2.0/mod/core.html#acceptpathinfo)?

This thing is quite impressive, my page load times (on a relatively busy 
vbulletin forum) have dropped dramatically
on 14.02.2006 22:39
Chris Hutzler wrote:

> Is there something 
> equal to apaches AcceptPathInfo directive to allow passing of trailing 
> pathname info to a script

never tried it, but it seems on the webserver side it can be
configured by multiple fastcgi.map-extensions definitions
and some mod_rewrite

the rest must be done in a php itself, just try it
and let us know so we can fight further :-)

---
Albatros Vep Taloha
http://www.host8.biz
on 18.02.2006 02:16
Chris Hutzler wrote:

> Is there something 
> equal to apaches AcceptPathInfo directive to allow passing of trailing 
> pathname info to a script

after testing I can confirm it works out of a box

in my configuration there is a script with filename just "8"

   fastcgi.map-extensions = ( "/8" => ".php" )

and it allows for clean URLs (SEO) like below:

   http://site.on.yourplanet.name/8/ml2500-xc204

in this example when you check environment by phpinfo()
it shows:

   SCRIPT_NAME is /8
and
   PATH_INFO is /ml2500-xc204

as expected


HTH
---
Albatros Vep Taloha
http://www.host8.biz
Posted by Ryan Schmidt
on 19.02.2006 23:58
Chris Hutzler wrote:
> Is there something equal to apaches AcceptPathInfo directive
> to allow passing of trailing pathname info to a script
> (http://httpd.apache.org/docs/2.0/mod/core.html#acceptpathinfo)?

Chris,

In addition to what Albatros said, you should enable the 
"broken-scriptfilename" option in your FastCGI handler, for example 
here's what I have:

fastcgi.server = ( ".php" =>
	( "localhost" =>
		(
			"socket" => "/tmp/php-5-fastcgi.socket",
			"bin-path" => "/usr/local/php-5/bin/php-fcgi",
			"bin-copy-environment" => ( "SHELL" ),
			"broken-scriptfilename" => "enable"
		)
	)
)

And you should add this to your php.ini:

cgi.fix_pathinfo = 1

Without these, the path info doesn't come through right. This is 
documented in the "Configuring PHP" section of this page:

http://www.lighttpd.net/documentation/fastcgi.html
Posted by Chris Hutzler
on 20.02.2006 06:35
Yup, I had all of that set, it still refused to work so I attacked it 
from the other side and modified the php scripts themselves, instead of 
calling for '$_SERVER['PHP_SELF']' I changed them to get 
'$_SERVER['REQUEST_URI']' which seemed to straighten things out and make 
them function as expected....

Ryan Schmidt wrote:
> Chris Hutzler wrote:
>> Is there something equal to apaches AcceptPathInfo directive
>> to allow passing of trailing pathname info to a script
>> (http://httpd.apache.org/docs/2.0/mod/core.html#acceptpathinfo)?
> 
> Chris,
> 
> In addition to what Albatros said, you should enable the 
> "broken-scriptfilename" option in your FastCGI handler, for example 
> here's what I have:
> 
> fastcgi.server = ( ".php" =>
> 	( "localhost" =>
> 		(
> 			"socket" => "/tmp/php-5-fastcgi.socket",
> 			"bin-path" => "/usr/local/php-5/bin/php-fcgi",
> 			"bin-copy-environment" => ( "SHELL" ),
> 			"broken-scriptfilename" => "enable"
> 		)
> 	)
> )
> 
> And you should add this to your php.ini:
> 
> cgi.fix_pathinfo = 1
> 
> Without these, the path info doesn't come through right. This is 
> documented in the "Configuring PHP" section of this page:
> 
> http://www.lighttpd.net/documentation/fastcgi.html
Posted by Daniel Watts
on 09.03.2006 19:13
Chris Hutzler wrote:
> Yup, I had all of that set, it still refused to work so I attacked it 
> from the other side and modified the php scripts themselves, instead of 
> calling for '$_SERVER['PHP_SELF']' I changed them to get 
> '$_SERVER['REQUEST_URI']' which seemed to straighten things out and make 
> them function as expected....
> 
> Ryan Schmidt wrote:
>> Chris Hutzler wrote:
>>> Is there something equal to apaches AcceptPathInfo directive
>>> to allow passing of trailing pathname info to a script
>>> (http://httpd.apache.org/docs/2.0/mod/core.html#acceptpathinfo)?
>> 
>> Chris,
>> 
>> In addition to what Albatros said, you should enable the 
>> "broken-scriptfilename" option in your FastCGI handler, for example 
>> here's what I have:
>> 
>> fastcgi.server = ( ".php" =>
>> 	( "localhost" =>
>> 		(
>> 			"socket" => "/tmp/php-5-fastcgi.socket",
>> 			"bin-path" => "/usr/local/php-5/bin/php-fcgi",
>> 			"bin-copy-environment" => ( "SHELL" ),
>> 			"broken-scriptfilename" => "enable"
>> 		)
>> 	)
>> )
>> 
>> And you should add this to your php.ini:
>> 
>> cgi.fix_pathinfo = 1
>> 
>> Without these, the path info doesn't come through right. This is 
>> documented in the "Configuring PHP" section of this page:
>> 
>> http://www.lighttpd.net/documentation/fastcgi.html

Hi guys,

I've read all this, and the doc page and done the two modifications:

php.ini: cgi.fix_pathinfo = 1
lighttpd.conf: "broken-scriptfilename" => "enable"

Then did
service lighttpd stop
service lighttpd start

But I still get no PHP_SELF value.

Do I need to do anything else?

INFO:
lighttpd/1.4.8
fastcgi php (PHP Version 4.4.2RC2-dev)
Centos OS (3 i think)
eaccelerator 0.9.3


Thanks!
Dan
Posted by Daniel Watts
on 24.03.2006 15:02

bump - anyone have any ideas at all?
The two mods above is all the info I could find for this fix and neither
work in any combination with each other. I'd really appreciate any help!
Daniel
Posted by Dan (Guest)
on 09.04.2006 12:47
Daniel Watts wrote:
> 
> 
> bump - anyone have any ideas at all?
> The two mods above is all the info I could find for this fix and neither
> work in any combination with each other. I'd really appreciate any help!
> Daniel

besides what you have, you need to write
 fastcgi.map-extensions = ( "/my_file" => ".php" )
  (if you have a my_file which you want to use as php, and then it works
as
  my_file/a/b  - php can process each parameter in "path".

you also need cgi.fix_pathinfo = 1 in php.ini, if you want PHP_SELF to 
work
Also I noticed you have lighttpd 1.4.8. For map-extensions and other
things to work you need at least 1.4.10 so go grab 1.4.11 rpm now :)

Dan