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:pecl-extension [2015/11/09 22:13]
Michael Alegre [Check The LiteSpeed Repository]
litespeed_wiki:php:pecl-extension [2019/11/29 15:45]
Lisa Clarke Added link to cURL page
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 extention ​is not in repository, you can send a request to support@litespeedtech.com for such package and we will make a evaluation on 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:
  
-The quick way is to build required pecl extention from source code by yourself.+  vi /​usr/​local/​lsws/​lsphp56/​etc/​php.ini
  
-Let's look at the an example ​of pecl imagick ​extentionIt is not available in LiteSpeed repository ​yet at the time of this writing. You can build the following steps to build it for lsphp55.+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 way, which 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 ===== 
 + 
 +You can also build the required PECL extension from source code yourself. 
 + 
 +Let's look at an example ​with the PECL imagick ​extension on a CentOS machineThis 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 41: Line 83:
   make install   make install
  
-Imagick ​extension is installed to the following ​folders:+The imagick ​extension is now installed to the following ​directories: 
   Installing shared extensions: ​    /​usr/​local/​lsws/​lsphp55/​lib64/​php/​modules/​   Installing shared extensions: ​    /​usr/​local/​lsws/​lsphp55/​lib64/​php/​modules/​
   Installing header files: ​         /​usr/​local/​lsws/​lsphp55/​include/​php/​   Installing header files: ​         /​usr/​local/​lsws/​lsphp55/​include/​php/​
  
 Modify the php.ini file by adding the following and restart LSWS. Modify the php.ini file by adding the following and restart LSWS.
-   ​extension = imagick.so 
-  ​ 
-Check phpinfo.php page and imagick should be enabled. 
  
-You can do the same thing to other LSPHP versions and other PECL extentions+  extension = imagick.so
  
-===== Install PEAR package manager ===== +Check the phpinfo.php page and you should see imagick enabled. 
-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 +You can do similar with other LSPHP versions and PECL extensions. 
-  wget http://pear.php.net/go-pear.phar + 
-  ​./lsphp go-pear.phar + 
-  ​ +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. 
-There is a bug on pecl script installed this way, which omit dynamic php modules including XML+ 
-Patch it by simply editing it to remove "​-n":​ +  ​apt-get install libmagickwand-dev pkg-config build-essential 
-  vi /​usr/​local/​lsws/​lsphp55/bin/pecl  ​ +  mkdir -p ~/tmp 
-Remove "​-n"​ from the following:​ +  pushd ~/tmp 
-  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 "​$@"​ +  wget https://pecl.php.net/get/imagick-3.4.3.tgz 
-     +  ​tar -xf imagick-3.4.3.tgz 
-then run  +  ​cd imagick-3.4.3 
-  ​/​usr/​local/​lsws/​lsphp55/bin/pecl install ​imagick +    /​usr/​local/​lsws/​lsphp70/bin/phpize 
-imagick.so ​will be installed to the right location. +    ./​configure ​--with-php-config=/​usr/​local/​lsws/​lsphp70/bin/php-config7.0 
-  chmod a+x /​usr/​local/​lsws/​lsphp55/lib64/php/modules/imagick.so +    make 
-Edit php.ini to enable extention and restart LSWS+    make install 
 +    echo "​extension=imagick.so" >> ​/​usr/​local/​lsws/​lsphp70/etc/php/7.0/mods-available/​40-imagick.ini 
 +    /​usr/​local/​lsws/​bin/​lswsctrl restart 
 +   ​popd 
 +  
 +===== See Also ===== 
 + 
 +See also [[litespeed_wiki:​php:​pecl-extension:​curl|How ​to Compile the cURL PHP Extension]].
  • Admin
  • Last modified: 2019/11/29 15:58
  • by Lisa Clarke