Project

General

Profile

Lighty and the PHP-FPM status page

Added by ba over 13 years ago

Hey,

with the latest stable release of PHP (5.3.4) on Gentoo (amd64) also comes PHP-FPM.
For better performance on my server I switched from FastCGI to FPM which was quite easy and works well on lighty. I also noticed that FPM has a status variable (pm.status_path) to set an URL getting current information about FPM.

Does anyone managed it or knows how to configure this with lighty?

Thanks!


Replies (12)

RE: Lighty and the PHP-FPM status page - Added by lifeofguenter over 13 years ago

need help on this one, too..

I always get a 404 error, guess because lighttpd does not handle php-reqests to non existent files? therefor it never reaches the php-fpm daemon?

RE: Lighty and the PHP-FPM status page - Added by ba over 13 years ago

Correct. Lighty doesn't know anything about the FPM status page and therefore it doesn't passes, e.g. /status, requests to the FPM daemon. The question is how to fix that.

Here is a thread at the nginx forum with a config example but I have no clue how to convert this to a valid lighty config: http://forum.nginx.org/read.php?3,56426,56426

RE: Lighty and the PHP-FPM status page - Added by Olaf-van-der-Spek over 13 years ago

"check-local" => "disable"

RE: Lighty and the PHP-FPM status page - Added by ba over 13 years ago

Olaf-van-der-Spek wrote:

"check-local" => "disable"

I don't get it. Any comments or hints on this?

RE: Lighty and the PHP-FPM status page - Added by ba over 13 years ago

I know this option but it doesn't change anything. Thus I asked for more information.
Maybe I miss something or this short spoken answers are just useless.

... - Added by ba over 13 years ago

pls delete this post

RE: Lighty and the PHP-FPM status page - Added by nitrox over 13 years ago

Just paste your current config snippets and use debug.log-request-handling = "enable", you either see whats happening or paste some important snippets from its output too.

You can also join #lighttpd on irc.freenode.net to get some more help, please point the folks in there to this thread and add the solution here afterwards, so others find it too.

RE: Lighty and the PHP-FPM status page - Added by ba over 13 years ago

Got it by applying an explicit FastCGI rule to the status host.

$HTTP["host"] =~ "^(www\.|)example.com$" {
...
  fastcgi.server = ( "/fpm-status" =>
                     (
                       ( "host" => "127.0.0.1",
                         "port" => 9000,
                         "check-local" => "disable" 
                       )
                     )
                   )
...
)

For this config you need to change your php-fpm.conf, of course.
pm.status_path = /fpm-status

Thanks for helping.

RE: Lighty and the PHP-FPM status page - Added by simfin almost 12 years ago

Could anyone please advise on how to get the fpm status page working on a socket (i.e. not host/port)?

Debian Squeeze, Lighty 1.4.28, PHP 5.3.14-1 (dotdeb)

and my fastcgi-php.conf =

fastcgi.server += ( ".php" =>
((
"socket" => "/var/run/php-fpm-lighttpd.sock"
))
)

Thank you.

RE: Lighty and the PHP-FPM status page - Added by mattorola7 over 11 years ago

I am currently using a socket and also am able to have the php-fpm status page passed through to php-fpm. If you use this technique, you can access the URL "/.status.fpm" and you don't need to bypass lighttpd's file existence check which will cause you to have some unexpected behavior anyway on 404 errors. Also, it will be lighter load on your PHP backend because bogus php requests won't ever make it to your PHP backend.

On your /etc/php-fpm.d/www.conf, set the following entries, commenting out the listen + tcp port 9000 and replace with an arbitrary socket path:

#listen = 127.0.0.1:9000
listen = /tmp/php-fpm.sock
pm.status_path = /.status.fpm

Then, in the root directory of your site, create the hidden empty file called .status.fpm. I chose to put a "." in front to keep it hidden:

cd /var/www/www.mysite.com/wwwroot
touch .status.fpm

Your /etc/lighttpd/lighttpd.conf file would then have an entry like the following. Notice the map-extensions will treat the .fpm file extension like it is a PHP script and will pass it to your php-fpm backend. I also commented out the check-local parameter since the file really does exist.

fastcgi.map-extensions = (".fpm" => ".php")
fastcgi.server             = ( ".php" =>
                               ( "localhost" =>
                                 (
                                   "socket" => "/tmp/php-fpm.sock" 
                                   #,"check-local" => "disable" 
                                 )
                              )
                            )

RE: Lighty and the PHP-FPM status page - Added by simfin about 11 years ago

Excellent - thanks for your help (and sorry for the belated thanks).

    (1-12/12)