How To: Install and Enable lsphp \ mod_lsapi for CloudLinux Plugin on InterWorx =============================================================================== Apache mod_lsapi is a module based on LiteSpeed Technologies API for PHP. It offers excellent PHP performance, and low memory footprint, coupled with great security and support for opcode caching. LSAPI is a persistent php process handler which means faster and more stable dynamic web pages. When combined with opcode caching, it offers superior performance to Su_PHP. LSPHP \ MOD_LSAPI is the only persistent opcode cache compatible PHP handler that fully supports the CloudLinux PHP version selector. Full Cloudlinux LSAPI documentation can be found `here `__. .. note:: LSPHP \ MOD_LSAPI for Cloudlinux on Interworx requires a valid Cloudlinux license and install. .. contents:: To Install Mod_LSAPI -------------------------------- .. note:: The following requires CloudLinux to already be installed. Instructions on how to do so can be found :doc:`here `. #. Log in to the CLI as root, either via SSH or from the terminal #. Run the following commands: .. code-block:: yum install liblsapi liblsapi-devel yum install mod_lsapi service httpd restart To Manage LSAPI Globally ------------------------ To Enable LSAPI Globally ^^^^^^^^^^^^^^^^^^^^^^^^ #. Log in to the CLI as root, either via SSH or from the terminal #. Run the following to create a global custom vhost PHP template, and automatically open the file: .. code-block:: ~iworx/bin/config.pex --customize-template php/vhost-mod-suphp.tpl --for-global #. Delete the IfModule mod_suphp.c section: .. code-block:: AddHandler x-httpd-php .php suPHP_AddHandler x-httpd-php .php suPHP_Engine On suPHP_UserGroup {$UNIX_USER} {$UNIX_USER} suPHP_ConfigPath {$PACKAGE_ROOT}/etc #. Add the following to the template: .. code-block:: AddType application/x-httpd-lsphp .php .php4 .php5 .php53 .php54 .php55 .php56 .php6 .phtml AddHandler application/x-httpd-lsphp .php .php4 .php5 .php53 .php54 .php55 .php56 .php6 .phtml #. The full, edited template should look like the following: .. code-block:: {* This template file is a custom InterWorx template, initially copied from: /home/interworx/etc/templates/php/vhost-mod-suphp.tpl Please refer to the original file for more information. *} # iw-php-mode : system-mod-suphp DirectoryIndex {$Config->get('HTTPD_DIRECTORY_INDEX')} AddType application/x-httpd-lsphp .php .php4 .php5 .php53 .php54 .php55 .php56 .php6 .phtml AddHandler application/x-httpd-lsphp .php .php4 .php5 .php53 .php54 .php55 .php56 .php6 .phtml #. Save and exit the file #. Run the following to update all existing vhosts: .. code-block:: ~iworx/bin/httpd.pex --write-vhosts-all #. Test the Apache configuration .. code-block:: httpd -t #. Restart Apache .. code-block:: systemctl restart httpd To Disable LSAPI and Restore the Default Global PHP Template ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ #. Delete the custom template file .. code-block:: rm /home/interworx/etc/templates/custom-globalphp/vhost-mod-suphp.tpl #. Run the follwing to update all existing vhost: .. code-block:: ~iworx/bin/httpd.pex --sync-vhosts-all #. Restart Apache .. code-block:: systemctl restart httpd To Mange LSAPI For a Single Domain ---------------------------------- To Enable LSAPI For a Single Domain ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ #. Log in to the CLI as root, either via SSH or from the terminal #. Run the following to create a single domain custom vhost PHP template, and automatically open the file. Replace {domain} with the domain the template should refer to: .. code-block:: ~iworx/bin/config.pex --customize-template php/vhost-mod-suphp.tpl --for-domain {domain} #. Delete the IfModule mod_suphp.c section: .. code-block:: AddHandler x-httpd-php .php suPHP_AddHandler x-httpd-php .php suPHP_Engine On suPHP_UserGroup {$UNIX_USER} {$UNIX_USER} suPHP_ConfigPath {$PACKAGE_ROOT}/etc #. Add the following to the template: .. code-block:: AddType application/x-httpd-lsphp .php .php4 .php5 .php53 .php54 .php55 .php56 .php6 .phtml AddHandler application/x-httpd-lsphp .php .php4 .php5 .php53 .php54 .php55 .php56 .php6 .phtml #. The full, edited template should look like the following: .. code-block:: {* This template file is a custom InterWorx template, initially copied from: /home/interworx/etc/templates/php/vhost-mod-suphp.tpl Please refer to the original file for more information. *} # iw-php-mode : system-mod-suphp DirectoryIndex {$Config->get('HTTPD_DIRECTORY_INDEX')} AddType application/x-httpd-lsphp .php .php4 .php5 .php53 .php54 .php55 .php56 .php6 .phtml AddHandler application/x-httpd-lsphp .php .php4 .php5 .php53 .php54 .php55 .php56 .php6 .phtml #. Save and exit the file #. Run the following to update the vhost for the domain, replacing {domain} with the domain of the vhost file: .. code-block:: ~iworx/bin/httpd.pex --write-vhost --domain {domain} #. Test the Apache configuration .. code-block:: httpd -t #. Restart Apache .. code-block:: systemctl restart httpd To Disable LSAPI and Restore the Default PHP Template For the Domain ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ #. Delete the custom template file, replacing {domain} with the domain the template referred to .. code-block:: rm /home/interworx/etc/templates/custom-domain/{domain}/php/vhost-mod-suphp.tpl #. Run the follwing to update the vhost, replacing {domain} with the domain of the vhost file: .. code-block:: ~iworx/bin/httpd.pex --sync-one-vhost --domain {domain} #. Restart Apache .. code-block:: systemctl restart httpd