Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
litespeed_wiki:php:lsapi [2015/11/18 17:29]
Jackson Zhang [Compiling PHP through WedAdmin Console]
litespeed_wiki:php:lsapi [2018/09/17 19:52]
Michael Alegre removed
Line 1: Line 1:
-====== Compile PHP for LSWS (with LSAPI) ======+====== Compile PHP for LSWS (with LSAPI) (Archive Only) ====== 
 +There is a functionality available in the LiteSpeed Web Server (LSWS) Web Admin console, “Compile PHP”. This is a legacy function used for previous releases but that will soon be retired. The function is incompatible with all current control panel environments such as cPanel, Plesk, and DirectAdmin. Even in environments without a control panel “Compile PHP” is obsolete. Especially with RPM and Debian Packages providing a more efficient way to install and configure PHP. There are even certain environments ( CloudLinux ) providing their own special packages for PHP that claim to be more secure and stable than that of the standard packages. There are currently not many use cases in which compiling PHP from source is required, but if one does run into such a case, please follow the following steps, but take note this is legacy information.
  
-This guide will take you through the steps to compile PHP (with LSAPI) for LiteSpeed Web Server (LSWS) . **This guide is recommended for for all users except WHM and DirectAdmin users.** Our [[http://​www.litespeedtech.com/​products/​control-panel-plugins/​cpanel-whm-plugin|WHM Plugin]] and [[litespeed_wiki:​directadmin:​custombuild-installation|DirectAdmin'​s CustomBuild integration]] offer more convenient methods for compiling PHP to match your Apache installation. 
- 
-[[http://​www.litespeedtech.com/​products/​litespeed-sapi/​overview|LiteSpeed Server API (LSAPI)]] is LiteSpeed'​s open-source API for communications between LSWS and external applications. LSWS can also use PHP with FastCGI (PHP-FPM), but LSAPI has repeatedly been shown to be [[http://​www.litespeedtech.com/​products/​litespeed-web-server/​benchmarks/​php-hello-world|faster and more efficient than FastCGI]]. PHP LSAPI also contains functionality,​ like [[http://​www.litespeedtech.com/​products/​litespeed-sapi/​php|suEXEC Daemon and ProcessGroup modes]], that PHP-FPM does not offer. 
  
 LSAPI is included in PHP packages 5.3 and up including PHP 7. PHP will automatically be configured for use with LSAPI when you compile PHP using LiteSpeed Web Server'​s Build PHP utility (WebAdmin console > Actions > Compile PHP). If a new version of PHP LSAPI comes out, simply recompile PHP and the new version will be installed. ​ LSAPI is included in PHP packages 5.3 and up including PHP 7. PHP will automatically be configured for use with LSAPI when you compile PHP using LiteSpeed Web Server'​s Build PHP utility (WebAdmin console > Actions > Compile PHP). If a new version of PHP LSAPI comes out, simply recompile PHP and the new version will be installed. ​
Line 11: Line 9:
 You can either compile PHP through LiteSpeed WebAdmin Console or from PHP source code downloaded from php.net. You can either compile PHP through LiteSpeed WebAdmin Console or from PHP source code downloaded from php.net.
  
-===== Compiling PHP through WedAdmin Console ​=====+===== Compiling PHP ===== 
 +==== Compiling PHP through WedAdmin Console ====
  
 === Access the Compile PHP utility === === Access the Compile PHP utility ===
Line 41: Line 40:
 You may need the folllowing packages for your PHP build. You may need the folllowing packages for your PHP build.
  
-For example for CentOS/​Redhat:​+For CentOS/​Redhat:​
  
   yum -y install epel-release   yum -y install epel-release
   yum -y install gcc   yum -y install gcc
-  yum -y install libxml2-devel libcurl-devel libpng-devel libmcrypt-devel+  yum -y install libxml2-devel libcurl-devel libpng-devel libmcrypt-devel ​openssl-devel 
 +   
 +For Debian/​Ubuntu:​ 
 +  sudo apt-get update 
 +  sudo apt-get install build-essential 
 +  sudo apt-get install pkg-config 
 +  sudo apt-get install libssl-dev libmcrypt-dev
  
-[[http://​open.litespeedtech.com/​mediawiki/​index.php/​Help:​Building_PHP_for_Drupal|Compile options for WordPress]]+[[http://​open.litespeedtech.com/​mediawiki/​index.php/​Help:​WordPress_Build_PHP|Compile options for WordPress]]
  
 [[http://​open.litespeedtech.com/​mediawiki/​index.php/​Help:​Building_PHP_for_Joomla|Compile options for Joomla!]] [[http://​open.litespeedtech.com/​mediawiki/​index.php/​Help:​Building_PHP_for_Joomla|Compile options for Joomla!]]
Line 78: Line 83:
  
 {{php_compile_restart.png?​700px}} {{php_compile_restart.png?​700px}}
-===== Compiling PHP from source code =====+==== Compiling PHP from source code ====
  
 === Download PHP source code === === Download PHP source code ===
Line 89: Line 94:
 ===Install build requirements === ===Install build requirements ===
 The following is a example for your build requirement,​ though you may not need all of them or you may need other packages depend on your compiling configuration. The following is a example for your build requirement,​ though you may not need all of them or you may need other packages depend on your compiling configuration.
 +
 +For CentOS/​Redhat:​
  
   yum install patch gcc glibc libstdc++ binutils libtool autoconf make bison pam-devel libcap-devel openssl-devel tcp_wrappers-devel bzip2-devel curl-devel db4-devel gmp-devel httpd-devel libstdc++-devel sqlite-devel sqlite2-devel liyuybedit-devel pcre-devel libtool gcc-c++ libtool-ltdl-devel libevent-devel libc-client-devel cyrus-sasl-devel openldap-devel mysql-devel postgresql-devel unixODBC-devel libxml2-devel net-snmp-devel libxslt-devel libxml2-devel libjpeg-devel libpng-devel freetype-devel libXpm-devel t1lib-devel libmcrypt-devel libtidy-devel freetds-devel aspell-devel recode-devel enchant-devel firebird-devel gdbm-devel tokyocabinet-devel   yum install patch gcc glibc libstdc++ binutils libtool autoconf make bison pam-devel libcap-devel openssl-devel tcp_wrappers-devel bzip2-devel curl-devel db4-devel gmp-devel httpd-devel libstdc++-devel sqlite-devel sqlite2-devel liyuybedit-devel pcre-devel libtool gcc-c++ libtool-ltdl-devel libevent-devel libc-client-devel cyrus-sasl-devel openldap-devel mysql-devel postgresql-devel unixODBC-devel libxml2-devel net-snmp-devel libxslt-devel libxml2-devel libjpeg-devel libpng-devel freetype-devel libXpm-devel t1lib-devel libmcrypt-devel libtidy-devel freetds-devel aspell-devel recode-devel enchant-devel firebird-devel gdbm-devel tokyocabinet-devel
 +
 +For Debian/​Ubuntu:​
 +  ​
 +  sudo apt-get build-essential pkg-config openssl libssl-dev openssl-blacklist openssl-blacklist-extra ​ bison autoconf automake libtool re2c flex libxml2-dev libssl-dev libbz2-dev libcurl4-openssl-dev libdb5.1-dev libjpeg-dev libpng12-dev libXpm-dev libfreetype6-dev libt1-dev libgmp3-dev libc-client2007e-dev libldap2-dev libmcrypt-dev libmhash-dev freetds-dev zlib1g-dev libmysqlclient-dev libncurses5-dev libpcre3-dev unixODBC-dev libsqlite0-dev libaspell-dev libreadline6-dev librecode-dev libsnmp-dev libtidy-dev libxslt-dev libt1-dev
   ​   ​
 ===  Configure, Compile and Install === ===  Configure, Compile and Install ===
Line 118: Line 129:
   Retry Timeout : 0   Retry Timeout : 0
   Response Buffering: no   Response Buffering: no
-  ​Auto Start: yes+  Start By Server: yes
   Command: $SERVER_ROOT/​lsphp56/​bin/​lsphp   Command: $SERVER_ROOT/​lsphp56/​bin/​lsphp
   Back Log: 100   Back Log: 100
Line 133: Line 144:
 Restart LiteSpeed to make it effective. ​ Restart LiteSpeed to make it effective. ​
  
 +===== Setup PHP.ini =====
  
 +Normally you can specify php.ini file path through '​-with-config-file-path=xxx'​ during the compiling. If not, you can verify through ​
 +  bin/lsphp -i | more 
 +  ​
 + ​Configuration File (php.ini) Path => /​usr/​local/​lsws/​lsphp56/​lib/​
 + ​Loaded Configuration File =>  /​usr/​local/​lsws/​lsphp56/​lib/​php.ini
 +
 +In general, you can copy a sample php.ini file from source code to lsphp56/lib location.
 +  cp php.ini-production lsphp56/​lib/​php.ini
 + 
 +You can run the php binary again to check if the php.ini file being loaded.
 +
 +  bin/lsphp -i | more 
 +  ​
 ===== Checking Installation ===== ===== Checking Installation =====
  
 There are a number of ways to check whether your PHP installation was successful. One of the simplest is to run the following code: There are a number of ways to check whether your PHP installation was successful. One of the simplest is to run the following code:
  
-  cd /​usr/​local/​lsws/​fcgi-bin/ + /​usr/​local/​lsws/​lsphp56/bin/lsphp -v
-  ./lsphp5 ​-v+
  
 It should return the information on your new PHP build: It should return the information on your new PHP build:
  
-  PHP 5.5.15 (litespeed) (built: Aug 20 2014 14:09:09)+  PHP 5.6.15 (litespeed) (built: Aug 20 2014 14:09:09)
   Copyright (c) 1997-2014 The PHP Group   Copyright (c) 1997-2014 The PHP Group
   Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies   Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
  • Admin
  • Last modified: 2018/09/17 19:52
  • by Michael Alegre