{"id":5158,"date":"2014-06-19T00:35:07","date_gmt":"2014-06-18T16:35:07","guid":{"rendered":"https:\/\/webhostinggeeks.com\/howto\/?p=5158"},"modified":"2023-04-28T09:48:18","modified_gmt":"2023-04-28T09:48:18","slug":"how-to-install-lighttpd-with-php5-php-fpm-and-mysql-on-centos-6-5","status":"publish","type":"post","link":"https:\/\/webhostinggeeks.com\/howto\/how-to-install-lighttpd-with-php5-php-fpm-and-mysql-on-centos-6-5\/","title":{"rendered":"How to Install Lighttpd With PHP5 (PHP-FPM) and MySQL on CentOS 6.5"},"content":{"rendered":"<p>Lighttpd (pronounced &#8220;lighty&#8221;) is an open-source web server as an alternative to Apache and Nginx. It is a secure, flexible, fast and designed for speed-critical environments. It has a low memory footprint and can handle large number of connections in one server especially for busier sites.<\/p>\n<p>PHP is an acronym for &#8220;PHP Hypertext Preprocessor&#8221;; PHP is a widely-used server-side scripting language executed on the server.<\/p>\n<p>PHP-FPM (FastCGI Process Manager) is an alternative PHP FastCGI implementation with some additional features useful for sites of any size, especially busier sites.<\/p>\n<p>MySQL is a popular database solution for use in web applications.<\/p>\n<p>This post will show you how to install Lighttpd With PHP5 (PHP-FPM) and MySQL on CentOS 6.5 VPS or dedicated server.<\/p>\n<p>1. EPEL repository is another extra repository that creates, maintains, and manages a high quality set of additional packages for Enterprise Linux, including, but not limited to, Red Hat Enterprise Linux (RHEL) and CentOS server. <a href=\"https:\/\/webhostinggeeks.com\/howto\/how-to-configure-epel-repository-on-centos-6-4-x86_64\/\">How to Configure EPEL Repository on CentOS<\/a>.<\/p>\n<p>2. Install Lighttpd, MySQL and PHP5 work in Lighttpd through PHP-FPM :<\/p>\n<pre>[root@centos6-05 ~]# yum install lighttpd php php-fpm lighttpd-fastcgi php-mysql mysql mysql-server -y\n<\/pre>\n<p>3. Configure Lighttpd :<\/p>\n<pre>[root@centos6-05 ~]# vi \/etc\/lighttpd\/lighttpd.conf\n<\/pre>\n<pre>server.use-ipv6 = \"enable\"\n<\/pre>\n<p>Change to :<\/p>\n<pre>server.use-ipv6 = \"disable\"\n<\/pre>\n<p>4. Make lighttpd start at boot and also start lighttpd service:<\/p>\n<pre>\n[root@centos6-05 ~]# chkconfig --levels 235 lighttpd on\n<\/pre>\n<pre>[root@centos6-05 ~]# \/etc\/init.d\/lighttpd start\n<\/pre>\n<p>Browse your web server and Lighttpd welcome page should be displayed :<br \/>\n<img decoding=\"async\" class=\"alignnone size-full wp-image-5159 lazyload\" data-src=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2014\/06\/lighttpd-centos6.5-1.png\" alt=\"lighttpd-centos6.5-1\" width=\"550\" height=\"399\" data-srcset=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2014\/06\/lighttpd-centos6.5-1.png 550w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2014\/06\/lighttpd-centos6.5-1-300x218.png 300w\" data-sizes=\"(max-width: 550px) 100vw, 550px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 550px; --smush-placeholder-aspect-ratio: 550\/399;\" \/><\/p>\n<p>5. Configure PHP to work in Lighttpd through PHP-FPM :<\/p>\n<pre>\n[root@centos6-05 ~]# vi \/etc\/php-fpm.d\/www.conf\n<\/pre>\n<p>Enable PHP-FPM use a TCP connection instead of unix socket :<\/p>\n<pre>\n;   '\/path\/to\/unix\/socket' - to listen on a unix socket.\n; Note: This value is mandatory.\nlisten = 127.0.0.1:9000\n<\/pre>\n<p>Configure user and group to lighttpd :<\/p>\n<pre>\n..\n..\n; RPM: apache Choosed to be able to access some dir as httpd\nuser = lighttpd\n; RPM: Keep a group allowed to write in log dir.\ngroup = lighttpd\n..\n..\n<\/pre>\n<p>6. Make php-fpm start at boot and also start the php-fpm service :<\/p>\n<pre>\n[root@centos6-05 ~]# chkconfig --levels 235 php-fpm on\n<\/pre>\n<pre>\n[root@centos6-05 ~]# \/etc\/init.d\/php-fpm start\n<\/pre>\n<p>7. Open and modify \/etc\/php.ini :<\/p>\n<pre>\n[root@centos6-05 ~]# vi \/etc\/php.ini\n<\/pre>\n<p>Uncomment the line cgi.fix_pathinfo=1<\/p>\n<pre>\n..\n; cgi.fix_pathinfo provides *real* PATH_INFO\/PATH_TRANSLATED support for CGI.  PHP's\n; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok\n; what PATH_INFO is.  For more information on PATH_INFO, see the cgi specs.  Setting\n; this to 1 will cause PHP CGI to fix its paths to conform to the spec.  A setting\n; of zero causes PHP to behave as before.  Default is 1.  You should fix your scripts\n; to use SCRIPT_FILENAME rather than PATH_TRANSLATED.\n; http:\/\/www.php.net\/manual\/en\/ini.core.php#ini.cgi.fix-pathinfo\ncgi.fix_pathinfo=1\n..\n<\/pre>\n<p>8. Open and modify \/etc\/lighttpd\/modules.conf :<\/p>\n<pre>\n[root@centos6-05 ~]# vi \/etc\/lighttpd\/modules.conf\n<\/pre>\n<p>Uncomment the line include &#8220;conf.d\/fastcgi.conf&#8221;:<\/p>\n<pre>\n..\n## FastCGI (mod_fastcgi)\n##\ninclude \"conf.d\/fastcgi.conf\"\n..\n<\/pre>\n<p>9. Open and modify \/etc\/lighttpd\/conf.d\/fastcgi.conf :<\/p>\n<p>Add below fastcgi.server at bottom of the file :<\/p>\n<pre>\n..\nfastcgi.server += ( \".php\" =>\n        ((\n                \"host\" => \"127.0.0.1\",\n                \"port\" => \"9000\",\n                \"broken-scriptfilename\" => \"enable\"\n        ))\n)\n..\n<\/pre>\n<p>10. Reload the PHP-FPM and Lighttpd service :<\/p>\n<pre>\n[root@centos6-05 ~]# \/etc\/init.d\/php-fpm reload\n<\/pre>\n<pre>\n[root@centos6-05 ~]# \/etc\/init.d\/lighttpd reload\n<\/pre>\n<p>11. Since MySQl has been install, dont forget to make MySQL start at boot and start the MySQL service :<\/p>\n<pre>\n[root@centos6-05 ~]# chkconfig --levels 235 mysqld on\n<\/pre>\n<pre>\n[root@centos6-05 ~]# \/etc\/init.d\/mysqld start\n<\/pre>\n<p>12. Create info.php under ligghttpd document root :<\/p>\n<pre>\n[root@centos6-05 ~]# vi \/var\/www\/lighttpd\/info.php\n<\/pre>\n<pre>\n&lt;?php\nphpinfo();\n?&gt;\n<\/pre>\n<p>Browse your page http:\/\/IP-Adress\/info.php. Thats all.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Lighttpd (pronounced &#8220;lighty&#8221;) is an open-source web server as an alternative to Apache and Nginx. It is a secure, flexible, fast and designed for speed-critical environments. It has a low&#8230;<\/p>\n","protected":false},"author":6,"featured_media":5161,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wds_primary_category":0,"footnotes":""},"categories":[2055,1161,1008,1025],"tags":[1244,1256,1535,1536,1914],"class_list":["post-5158","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","category-lighttpd","category-mysql","category-php","tag-centos","tag-centos-6-5","tag-lighttpd","tag-linux","tag-web-server"],"_links":{"self":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/5158","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/comments?post=5158"}],"version-history":[{"count":0,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/5158\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media\/5161"}],"wp:attachment":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media?parent=5158"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/categories?post=5158"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/tags?post=5158"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}