Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Web Servers»Lighttpd»How to Install Lighttpd with PHP and MariaDB on CentOS/RHEL 6/5

    How to Install Lighttpd with PHP and MariaDB on CentOS/RHEL 6/5

    By RahulApril 20, 20142 Mins Read

    Lighttpd is an alternative to Apache. It is a opensource web server. Lighttpd is popular for its low memory and cpu uses, This can be best option for high traffic sites. PHP is a programming language used server-side programming. MariaDB is an alternative of MySQL with various of enhancements.

    Advertisement

    Step 1: Add Required Yum Repositories

    Before starting setup, make sure that we have required yum repositories added in our system. We recommend to add MariaDB, EPEL and REMI yum repositories in our system.

    https://downloads.mariadb.org/mariadb/repositories/#mirror=nus
    https://tecadmin.net/top-5-yum-repositories-for-centos-rhel-systems/#centalt-repo
    https://tecadmin.net/top-5-yum-repositories-for-centos-rhel-systems/#remi-repo

    Step 2: Install Lighttpd

    Lets start with the installation of lighttpd web server with fastcgi support using following command

    # yum install lighttpd lighttpd-fastcgi
    

    Now edit Lighttpd configuration file /etc/lighttpd/lighttpd.conf and update following values.

    server.use-ipv6 = "disable"
    server.max-fds = 2048
    

    Now start Lighttpd service

    # service lighttpd start
    

    Step 3: Install MariaDB

    Assuming that you have already added MariaDB yum repositories, Let’s use the following command to install MariaDB on your system

    # yum install MariaDB-server MariaDB-client
    

    Start MaraiDB service

    # service mysql start
    

    Complete the post installation setup to secure your MariaDB

    # mysql_secure_installation
    

    Step 4: Install PHP and PHP-FPM

    Install PHP, PHP-FPM and php-mysql packages using below command

    # yum --enablerepo=epel,remi install php php-fpm php-mysql
    

    Edit configuration file /etc/php-fpm.d/www.conf an update following values

     listen = 127.0.0.1:9000
     user = lighttpd
     group = lighttpd
    

    Step 5: Configure FASTCGI and PHP-FPM

    Enable PHP5 in Lighttpd, Edit the php configuration file /etc/php.ini and uncomment following line

     cgi.fix_pathinfo=1
    

    Now edit Lighttpd modules configuration /etc/lighttpd/modules.conf and uncomment following line to enable fastcgi support

     include "conf.d/fastcgi.conf"
    

    Now edit Lighttpd fastcgi configuration file /etc/lighttpd/conf.d/fastcgi.conf and add following values

    fastcgi.server += ( ".php" =>
            ((
                    "host" => "127.0.0.1",
                    "port" => "9000",
                    "broken-scriptfilename" => "enable"
            ))
    )
    

    Restart all services using following commands and enable them to auto start on system boot

    # service lighttpd restart
    # service php-fpm restart
    
    # chkconfig lighttpd on
    # chkconfig php-fpm on
    

    Step 6: Verify Setup

    At this point we have successfully completed all the configuration. Lets create an info.php file in your document root with following content.

    <?php
    phpinfo();
    ?>
    

    php-with-lighttpd

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    PHP Arrays: A Beginner’s Guide

    Installing PHP on Pop!_OS

    How to Install PHP 8.x on Pop!_OS

    Installing MySQL 8.0 on Amazon Linux 2

    How To Install MySQL 8 on Amazon Linux 2

    Add A Comment

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • Configure Postfix to Use Gmail SMTP on Ubuntu & Debian
    • PHP Arrays: A Beginner’s Guide
    • Deploying Flask Application on Ubuntu (Apache+WSGI)
    • OpenSSL: Working with SSL Certificates, Private Keys and CSRs
    • How to Create and Read List in Python
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.