• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here:Home » How To Install lighttpd PHP5-FPM (LLMP CentOS 7)

By Abhishek Ghosh July 14, 2017 6:25 am Updated on July 14, 2017

How To Install lighttpd PHP5-FPM (LLMP CentOS 7)

Advertisement

lighttpd is not production ready and CentOS is better os over Ubuntu or Debian. It is very difficult to make lighttpd running on Ubuntu 16.04. We are using PHP 5.4 not PHP 7.1. We are writing the guide because one person requested us out of errors. Here is how to install lighttpd PHP5-FPM on CentOS. By default supplied configuration files are not closest to usable to run WordPress like common software but CentOS has enough in repo to make it running. With our guide, you’ll not get errors, at least lighttpd will start. LLMP is Linux, lighttpd, MySQL, PHP. You should serious consider to use Apache with HTTP/2 on production server and tweak for performance or use Nginx in case RAM is lower like Raspberry Pi. Spin a new cloud server instance and test.

How To Install lighttpd PHP5-FPM LLMP CentOS 7

 

How To Install lighttpd PHP5-FPM On CentOS 7

 

SSH to the instance. First update :

Vim
1
yum update -y

We need to prepare to have required packages to make things working :

Advertisement

---

Vim
1
yum -y install nano wget epel-release

Install lighttpd

First step is setting up Lighttpd. This command installs Lighttpd package with its default configuration :

Vim
1
yum -y install lighttpd

Lighttpd is installed but not configured to launch on boot, run these commands :

Vim
1
2
systemctl start lighttpd
systemctl enable lighttpd

Please open your browser and point to open your server’s IP. There will be default Lighthttpd webpage for CentOS.
The document root is /var/www/htdocs but the installation creates /var/www/lighttpd.

Probably optional step is changing /var/www/lighttpd document root. If you want to change to /var/www/htdocs, then will run :

Vim
1
mv /var/www/lighttpd /var/www/htdocs

And open lighttpd.conf :

Vim
1
nano /etc/lighttpd/lighttpd.conf

You will find this line and need to reflect the pathname of /var/www/htdocs :

Vim
1
    server.document-root = server_root + "/htdocs"

So for /var/www/lighttpd, it should be :

Vim
1
server.document-root = server_root + "/lighttpd"

There was bug thats why the issue needed to mention. The next steps are not optional.

Install PHP-FPM

You should have used Nginx for minimum 1 year on a production server for experience with PHP-FPM. It is not Apache, it is never funny to run PHP-FPM on production server. First, install the minimum needed packages :

Vim
1
yum -y install php-fpm lighttpd-fastcgi

www.conf needs editing. We need to configure PHP-FPM to run as the lighttpd user, so open :

Vim
1
nano /etc/php-fpm.d/www.conf

Scroll to find these :

Vim
1
2
3
4
; RPM: apache Choosed to be able to access some dir as httpd
user = apache
; RPM: Keep a group allowed to write in log dir.
group = apache

You have to change to :

Vim
1
2
3
4
; RPM: apache Choosed to be able to access some dir as httpd
user = lighttpd
; RPM: Keep a group allowed to write in log dir.
group = lighttpd

Save this file. PHP-FPM needs start and must be configured to start at boot :

Vim
1
2
systemctl start php-fpm.service
systemctl enable php-fpm.service

Open /etc/php.ini, and find the line ;cgi.fix_pathinfo=1 :

Vim
1
nano /etc/php.ini

This block :

Vim
1
2
3
4
5
; Setting this to 1 will cause PHP CGI to fix its paths to conform to the spec. A setting
; of zero causes PHP to behave as before. Default is 1. You should fix your scripts
; to use SCRIPT_FILENAME rather than PATH_TRANSLATED.
; http://php.net/cgi.fix-pathinfo
;cgi.fix_pathinfo=1

That ;cgi.fix_pathinfo=1 last line should be active (; removed) :

Vim
1
cgi.fix_pathinfo=1

Save this file. Now open to edit modules.conf :

Vim
1
nano /etc/lighttpd/modules.conf

Find and uncomment (remove # at the beginning of the line), this line:

Vim
1
include "conf.d/fastcgi.conf"

Save it.

Now, fastcgi.conf also must also be edited :

Vim
1
nano /etc/lighttpd/conf.d/fastcgi.conf

You’ll see a line :

Vim
1
server.modules += ( "mod_fastcgi" )

Add this after that line :

Vim
1
2
3
4
5
6
7
fastcgi.server += ( ".php" =>
((
"host" => "127.0.0.1",
"port" => "9000",
"broken-scriptfilename" => "enable"
))
)

Save and exit.

In order for the changes to take effect, we must now restart services :

Vim
1
2
systemctl restart lighttpd.service
systemctl restart php-fpm.service

Create a basic PHP info page. Remove the Lighttpd default page from the document root :

Vim
1
cd /var/www/lighttpd

If you do ls -al :

Vim
1
2
3
4
5
6
7
drwx------ 2 lighttpd lighttpd  4096 Jul 14 04:57 .
drwxr-xr-x 3 root     root      4096 Jul 14 04:57 ..
-rw-r--r-- 1 root     root      3638 Jan 17 16:32 favicon.ico
-rw-r--r-- 1 root     root       844 Jan 17 16:32 index.html
-rw-r--r-- 1 root     root      2072 Jan 17 16:32 light_button.png
-rw-r--r-- 1 root     root     35431 Jan 17 16:32 light_logo.png
lrwxrwxrwx 1 root     root        32 Jul 14 04:57 poweredby.png -> /usr/share/pixmaps/poweredby.png

Replace index.html with a PHP page :

Vim
1
2
rm index.html
nano index.php

In that index.php, copy paste this content and save :

Vim
1
<!--?php phpinfo(); ?-->

Please open your browser and point to open your server’s IP. There will be default Lighthttpd webpage for CentOS.

Install MariaDB MySQL fork

We will install MariaDB which is a MySQL fork. On Apache, Nginx we use Percona MySQL fork for performance. In case you need basic MySQL commands like creating database please later read our Nginx WordPress guide’s MySQL part.

Vim
1
2
yum install php-mysql -y
yum -y install mariadb mariadb-server

Next step configures MariaDB to start and also launch when the server boots up after restart as service, restart other services :

Vim
1
2
3
4
systemctl start mariadb.service
systemctl enable mariadb.service
systemctl restart lighttpd.service
systemctl restart php-fpm.service

There are common steps needed to configure and harden MySQL :

Vim
1
mysql_secure_installation

Tagged With centos 7 install php5-fpm , how to know how many fpm your computer is producing
Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to How To Install lighttpd PHP5-FPM (LLMP CentOS 7)

  • Nginx WordPress Installation Guide (All Steps)

    This is a Full Nginx WordPress Installation Guide With All the Steps, Including Some Optimization and Setup Which is Compatible With WordPress DOT ORG Example Settings For Nginx.

  • XCache Admin Page on Nginx-PHP5-FPM (Ubuntu, HP Cloud)

    Here is How to Setup a XCache Admin Page on Nginx-PHP5-FPM on Ubuntu Instance Running on HP Cloud. It Gives a Clear Graphical Idea of Caching.

  • Changing Data With cURL for OpenStack Swift (HP Cloud CDN)

    Changing Data With cURL For Object is Quite Easy in OpenStack Swift. Here Are Examples With HP Cloud CDN To Make it Clear. Official Examples Are Bad.

  • OpenStack Swift & HPCloud CDN PHP Bindings : Basics

    Here is the basics of OpenStack Swift & HPCloud CDN PHP Bindings for the WordPress Plugin developers and those who works with PHP based CMS.

performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • Hybrid Multi-Cloud Environments Are Becoming UbiquitousJuly 12, 2023
  • Data Protection on the InternetJuly 12, 2023
  • Basics of BJT TransistorJuly 11, 2023
  • What is Confidential Computing?July 11, 2023
  • How a MOSFET WorksJuly 10, 2023
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy