News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

lighttpd + fastcgi PHP Howto: anybody interested?

Started by sirwoogie, December 21, 2005, 03:23:44 PM

Previous topic - Next topic

sirwoogie

I have a pretty decent setup running lighttpd and fastcgi enabled php (with eAccelerator) under Linux. I can draft up a howto if anybody is interested. It significantly reduced my load on the server and increased the speed for my users.

Anybody interested?

syberdave

Did you ever get search-engine friendly URLs to work? I have SMF using Lighttpd, too.

And does eAccelerator make a big difference?

sirwoogie

I never had a problem with the SE setting working right out of the box.

eAccelerator makes a huge difference, but be sure to run lighttpd + FastCGI using the spawn-fcgi style interface. If you rely on the internal one built into lighttpd, you don't get nearly as much benefit from the caching.

As an added point, I've found in my instance that using memcached with the 1.1RC2 release actually is a detriment to performance. Of course, your mileage may vary.

syberdave

I enabled the feature, but it still doesn't work. The help box for that option says:

QuoteThis changes the format of URLs a little so search engines will like them better. They will look like index.php/topic,1.html.

This feature will not work on your server.

However, my URLs are still like: index.php?topic=3.0
I'm guessing that it doesn't really enable it because I'm not using Apache.


Thanks, I'll look into the spawn-fcgi thing soon. I didn't think that there would be a difference so I never paid any attention to it. And I'll also look at eAccelerator.

sirwoogie

Well, I now take it back. My forum isn't doing it. The checkbox is checked, but the help does say it can't handle it. I also verified that the main forum links are now reverting back to the parameter style. However, I've modified my theme a bit to have a menu that uses the SE friendly format and they work just fine. Thus, lighttpd is supporting this style out of the box. I'll have to dig into the Sources code to find why SMF is ignoring the configuration parameter.

Regarding the FastCGI component, the information is buried in the eaccelerator forums at:
http://sourceforge.net/forum/forum.php?thread_id=1205624&forum_id=416741

It's linked from:
http://trac.lighttpd.net/trac/wiki/LighttpdWithPHP


syberdave

Yeah, I'll look in the source, too, when I have some time. I don't like how you can't force it to work. In Wordpress and Joomla, I can force it to turn on and tell lighttpd to handle 404 errors with index.php and it would work fine.

I'm wondering if SMF would create a .htaccess file for you if it is running with Apache.

syberdave

I'm sorry to be a pain, but can you post the section of your lighttpd.conf where you use spawn-fcgi?

I found the documentation at http://www.lighttpd.net/documentation/fastcgi.html [nofollow], but however, there aren't any examples on how to do "External spawning." In fact, I'm not even sure if external spawning is what I need.

Here are the lines from my config:

fastcgi.server              = ( ".php" =>
                                ( "localhost" =>
                                  (
                                    "socket" => "/tmp/php-fastcgi.socket",
                                    "bin-path" => "/usr/bin/php-cgi",
                                     "bin-copy-environment" => (
                                             "PATH", "SHELL", "USER"
                                     ),
                                    "bin-environment" => (
                                        "PHP_FCGI_CHILDREN" => "2",
                                        "PHP_FCGI_MAX_REQUESTS" => "10000"

                                    ),
                                    "broken-scriptfilename" => "enable"
                                  )
                                )
                              )

sirwoogie

Not being a pain at all! Don't worry about it. This is how you learn. :)


fastcgi.server = ( ".php" =>
                            ( "localhost" =>
                              (
                                 "host"               =>              "127.0.0.1",
                                 "port"               =>              1026,
                                 "bin-path"        =>              "/usr/bin/php-cgi"
                               )
                             )
                           )

tabo

Just to let you guys know, I have SMF 1.1 RC2 working with search engine friendly URLs enabled with lighttpd. You will have to edit these files:

Sources/News.php
Sources/QueryString.php
Sources/Subs.php

and remove the checks for $context['server']['is_apache']

Note: You will have to set cgi.fix_pathinfo=1 in php.ini

Advertisement: