PHP-FPM and LIGHTTPD
+
Par Remi le mardi 28 septembre 2010, 18:51 - HowTo - Lien permanent
Since PHP 5.3.3, the PHP-FPM engine is bundled. The php-fpm package is available in remi repository and will be soon in rawhide.
This entry show how to use it with the lighttpd web server.
My goal is to install a working web server, for local and packaged (RPM) applications, I will use phpMyAdmin as an example.
1. Installation :
yum --enablerepo=remi install php-fpm phpMyAdmin lighttpd-fastcgi
This command will also install the apache web server, listening on port 80. I will not use it, but I will configure lighttpd to listen on port 81.
2. Creating my web site
With lighttpd, pages are, by default, installed in the /var/www/lighttpd directory.
My application will be very minimal:
echo '<?php phpinfo(); ?>' >/var/www/lighttpd/lhinfo.php
3. Lighttp configuration
I'm really not an expert on this web server, but, reading the documentation (quite good), I found a working solution:
Edit the /etc/lighttpd/lighttpd.conf configuration file:Port (uncomment and change the line) :
server.port = 81
Activation of the needed modules (uncomment the lines) :
"mod_alias",
"mod_fastcgi",
Fastcgi module configuration (add the lines)
fastcgi.server = ( ".php" =>
((
"host" => "127.0.0.1",
"port" => 9000
))
)
Alias for phpMyAdmin configuration, create the /etc/lighttpd/conf.d/phpMyAdmin.conf file:
alias.url += ( "/phpMyAdmin" => "/usr/share/phpMyAdmin/" )
4. Launch the services
service php-fpm start
service lighttpd start
5. URL de test
- http://localhost:81/ the default provided by lighttpd home page
- http://localhost:81/lhinfo.php my great application
- http://localhost:81/phpMyAdmin/ a packaged application
6. Conclusion
It works !