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
litespeed_wiki:php:pecl-extension [2015/11/09 22:25]
Michael Alegre [Compile from Source Code]
litespeed_wiki:php:pecl-extension [2019/11/29 15:58] (current)
Lisa Clarke [See Also] Added GD
Line 1: Line 1:
 ====== How To Install a PECL Extension For LSPHP? ====== ====== How To Install a PECL Extension For LSPHP? ======
  
-You may need a certain PHP PECL extension to get your application working. The usual method of ''/​usr/​local/​lsws/​lsphp5x/​bin/​pecl install extention-name''​ may not work as there is no lsphp5x-pear package available at the time of this writing.+You may need a certain PHP PECL extension to get your application working. ​
  
 There are several other ways to get a PHP PECL extension installed: There are several other ways to get a PHP PECL extension installed:
  
   * Check the LiteSpeed repository for package availability   * Check the LiteSpeed repository for package availability
 +  * Use lsphp5x-pear or lsphp70-pear package
 +  * Install the PEAR package manager
   * Compile from Source Code   * Compile from Source Code
-  * Install the PEAR package manager 
- 
 ===== Check The LiteSpeed Repository ===== ===== Check The LiteSpeed Repository =====
  
Line 20: Line 20:
 If the extension is there, simply ''​yum install''​ and your all set. If the extension is there, simply ''​yum install''​ and your all set.
  
-===== Compile From Source Code =====+If the extension is not in our repository, you can send a request to support@litespeedtech.com requesting it's inclusion and we will evaluate the possibility of adding it.  
 +===== Use "​./​pecl install"​ command ​===== 
 +Install lsphp5x-pear or lsphp70-pear package, which will install pecl under /​usr/​local/​lsws/​lsphp5x/​bin/​. Then use the usual method of ''/​usr/​local/​lsws/​lsphp5x/​bin/​pecl install extention-name''​.
  
-If the extension is not in our repositoryyou can send a request ​to support@litespeedtech.com requesting it's inclusion and we will evaluate ​the possibility off adding it+  yum install lsphp56-pear 
 +  yum install ImageMagick-devel 
 +  /​usr/​local/​lsws/​lsphp56/​bin/​pecl install imagick 
 +   
 +Edit related php.ini file to enable extention imagick: 
 + 
 +  vi /​usr/​local/​lsws/​lsphp56/​etc/​php.ini 
 + 
 +and add the following:​ 
 + 
 +  ​extension=imagick.so 
 +   
 +restart LSWS. 
 +===== Install The PEAR Package Manager ===== 
 + 
 +You can also install the [[http://​pear.php.net/​manual/​en/​installation.getting.php|PEAR package manager]] to manage PECL extensions. 
 +  cd /​usr/​local/​lsws/​lsphp55/​bin 
 +  wget http://​pear.php.net/​go-pear.phar 
 +  ./lsphp go-pear.phar 
 +   
 +There is a bug in PECL scripts when installed this waywhich omits dynamic PHP modules including XML. You can patch it by simply editing it to remove the "​-n"​ cauisng the problem: 
 + 
 +  vi /​usr/​local/​lsws/​lsphp55/​bin/​pecl 
 +     
 +Remove "​-n"​ from the following:​ 
 +   
 +  exec $PHP -C -n -q $INCARG -d date.timezone=UTC -d output_buffering=1 -d variables_order=EGPCS -d safe_mode=0 -d register_argc_argv="​On"​ $INCDIR/​peclcmd.php "$@
 +     
 +then, using imagick for example, run  
 +   
 +  /​usr/​local/​lsws/​lsphp55/​bin/​pecl install imagick 
 + 
 +imagick.so should now be installed to the correct location. 
 +   
 +  chmod a+x /​usr/​local/​lsws/​lsphp55/​lib64/​php/​modules/​imagick.so 
 + 
 +Lastly, edit your php.ini file to enable extension  
 +  extension=imagick.so 
 +and restart LSWS 
 + 
 +===== Compile From Source Code =====
  
-A quicker method is to also build the required PECL extension from source code yourself.+You can also build the required PECL extension from source code yourself.
  
-Let's look at an example with the PECL imagick extension. This extension is not available in the LiteSpeed repository at the time of this writing. You can perform the following steps to build it for lsphp55 yourself.+Let's look at an example with the PECL imagick extension ​on a CentOS machine. This extension is not available in the LiteSpeed repository at the time of this writing. You can perform the following steps to build it for lsphp55 yourself.
  
   yum install epel-release   yum install epel-release
Line 53: Line 95:
  
 You can do similar with other LSPHP versions and PECL extensions. You can do similar with other LSPHP versions and PECL extensions.
-===== Install PEAR package manager ===== + 
-You can also install [[http://pear.php.net/manual/​en/​installation.getting.php|PEAR package manager]] to manage pecl extentions. + 
-  ​cd /​usr/​local/​lsws/​lsphp55/bin +Let's look at another example with the PECL imagick extension on a Ubuntu/Debian machineAssuming that you have install lsphp70 through LiteSpeed APT repository. 
-  wget http://pear.php.net/go-pear.phar + 
-  ​./lsphp go-pear.phar +  apt-get install libmagickwand-dev pkg-config build-essential 
-  ​ +  mkdir -p ~/tmp 
-There is a bug on pecl script installed this way, which omit dynamic php modules including XML+  ​pushd ~/tmp 
-Patch it by simply editing it to remove "​-n":​ +  wget https://pecl.php.net/get/imagick-3.4.3.tgz 
-  vi /​usr/​local/​lsws/​lsphp55/bin/pecl  ​ +  ​tar -xf imagick-3.4.3.tgz 
-Remove "​-n"​ from the following:​ +  ​cd imagick-3.4.3 
-  exec $PHP -C -n -q $INCARG -d date.timezone=UTC ​-d output_buffering=1 ​-d variables_order=EGPCS ​-d safe_mode=0 ​-d register_argc_argv="​On"​ $INCDIR/​peclcmd.php "​$@"​ +    /​usr/​local/​lsws/​lsphp70/bin/phpize 
-     +    ./​configure ​--with-php-config=/​usr/​local/​lsws/​lsphp70/bin/php-config7.0 
-then run  +    make 
-  ​/​usr/​local/​lsws/​lsphp55/bin/pecl install ​imagick +    make install 
-imagick.so ​will be installed to the right location. +    echo "​extension=imagick.so" >> ​/​usr/​local/​lsws/​lsphp70/etc/php/7.0/mods-available/​40-imagick.ini 
-  chmod a+x /​usr/​local/​lsws/​lsphp55/lib64/php/modules/imagick.so +    /​usr/​local/​lsws/​bin/​lswsctrl restart 
-Edit php.ini to enable extention and restart LSWS. +   ​popd 
 +  
 +===== See Also ===== 
 + 
 +  * [[litespeed_wiki:​php:​pecl-extension:​curl|How ​to Compile the cURL PHP Extension]] 
 +  * [[litespeed_wiki:​php:​pecl-extension:​gd|How to Compile the GD PHP Extension]]
  • Admin
  • Last modified: 2015/11/09 22:25
  • by Michael Alegre