Knowledgebase

Configure CloudLinux software, PHP and mod_lsapi on a server with no control panel

Configuring CloudLinux, PHP, and mod_lsapi on a server without a control panel involves several steps. Here's a step-by-step guide:

  1. Install CloudLinux:

    • Follow the official CloudLinux installation instructions provided by CloudLinux Inc.
  2. Update System Packages:

    • Ensure that your system is up-to-date by running the following commands:
    SQL

 

  • sudo yum update
  • Install PHP:

    • Install the desired version of PHP along with the necessary modules. For example, to install PHP 7.4, use the following command:
     
  • sudo yum install php74 php74-php php74-php-common php74-php-cli php74-php-fpm php74-php-mbstring php74-php-mysqlnd
  • Configure PHP:

    • Edit PHP configuration files based on your specific requirements. The main PHP configuration file is typically located at /etc/php.ini.
  • Install mod_lsapi:

    • CloudLinux provides mod_lsapi as an Apache module for improved PHP performance. To install mod_lsapi, run:
     
  • sudo yum install liblsapi liblsapi-devel
  • Enable mod_lsapi:

    • Add the following lines to your Apache configuration file (/etc/httpd/conf/httpd.conf or a custom virtual host configuration file):
    bash
  • LoadModule lsapi_module modules/mod_lsapi.so <IfModule lsapi_module> AddHandler application/x-httpd-lsphp .php LSAPI_AppEnv PHP_LSAPI_CHILDREN 5 </IfModule>
  • Restart Apache:

    • After making changes to the Apache configuration, restart Apache to apply the changes:
     
  • sudo systemctl restart httpd
  • Verify mod_lsapi Configuration:

    • Check the Apache error logs for any issues related to mod_lsapi. Resolve any errors that may occur during the restart process.
  • Configure PHP for mod_lsapi:

    • In your PHP configuration file (/etc/php.ini), set lsapi_with_pkg to 1:
    makefile
  • lsapi_with_pkg = 1
  • Restart PHP-FPM (if applicable):

    • If you're using PHP-FPM, restart it to apply the changes:
     
  • sudo systemctl restart php74-php-fpm
  • Verify PHP Configuration:

    • Create a PHP info file (e.g., info.php) with the following content:
    php

 

  1. <?php phpinfo(); ?>

    Access this file via a web browser to verify that PHP and mod_lsapi are working correctly.

  2. Set Correct File Permissions:

    • Ensure that the files and directories in your web root have appropriate permissions so that Apache can serve them.
  3. Configure PHP Options for Websites:

    • For each website, you can customize PHP settings by adding a .htaccess file with directives specific to that site.
  4. Security Considerations:

    • Implement security measures such as firewall rules, fail2ban, and regular security audits.

Remember to replace any placeholder values (like PHP versions, paths, etc.) with your actual configurations.

Please note that this guide assumes a basic setup and doesn't cover advanced configurations. Always refer to the official documentation for each software component for detailed information and troubleshooting. Additionally, consider consulting with a system administrator or CloudLinux support for personalized assistance.

 
  • 0 Users Found This Useful
Was this answer helpful?