• 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

This Article Has Been Shared 133 Times!

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)

  • Cloud Computing Leaders – Brands Who Revolutionized the Cloud

    Cloud Computing Leaders are not many in number. Only few Brands revolutionized Cloud Computing either offering as a free service or at a lower cost.

  • What is Cloud in Cloud Computing

    What is Cloud in Cloud Computing – very basic question but unanswered in most Cloud Computing related articles. Author explains about Cloud in plain English.

  • Cloud Computing and Ubuntu : Richard Stallman’s View

    Cloud Computing and Ubuntu both historically is being criticized by Richard Stallman not once but many a times. Why Father of Free Software Movement is against?

  • Competition in Cloud Computing

    Competition in cloud computing is making the IaaS and PaaS to grow together. PaaS is almost by all the providers has a good free usage quota. This is a plus.

  • Installing Fail2ban on Ubuntu 14.04 : Nginx, HP Cloud

    Here is Guide With Steps on Installing Fail2ban on Ubuntu 14.04 on Server Running Nginx on HP Cloud. It adds a layer of security to SSH.

Additionally, 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

  • How to Do Electrical Layout Plan for Adding Smart Switches January 26, 2023
  • What is a Data Mesh? January 25, 2023
  • What is Vehicular Ad-Hoc Network? January 24, 2023
  • Difference Between Panel Light, COB Light, Track Light January 21, 2023
  • What is COB LED? How LED Chip On Board Works January 20, 2023

About This Article

Cite this article as: Abhishek Ghosh, "How To Install lighttpd PHP5-FPM (LLMP CentOS 7)," in The Customize Windows, July 14, 2017, January 27, 2023, https://thecustomizewindows.com/2017/07/how-to-install-lighttpd-php5-fpm-centos-7/.

Source:The Customize Windows, JiMA.in

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

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Do not sell my personal information.
Cookie SettingsAccept
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT