Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
litespeed_wiki:php:pecl-extension [2016/01/12 20:46] Jackson Zhang [Use ./pecl install command] |
litespeed_wiki:php:pecl-extension [2019/05/03 16:21] qtwrk [Compile From Source Code] |
||
---|---|---|---|
Line 7: | Line 7: | ||
* Check the LiteSpeed repository for package availability | * Check the LiteSpeed repository for package availability | ||
* Use lsphp5x-pear or lsphp70-pear package | * 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 21: | 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. | ||
+ | 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 ===== | ===== 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''. | 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''. | ||
Line 36: | Line 36: | ||
extension=imagick.so | 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 | ||
| | ||
- | ===== Compile From Source Code ===== | + | 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: |
- | 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 off adding it. | + | 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 | ||
- | A quicker method is to also build the required PECL extension from source code yourself. | + | 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. 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 70: | 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 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 | + | Let's look at another example with the PECL imagick extension on a Ubuntu/Debian machine. Assuming that you have install lsphp70 through LiteSpeed APT repository. |
- | + | ||
- | 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. | + | apt-get install libmagickwand-dev pkg-config build-essential |
- | + | mkdir -p ~/tmp | |
- | chmod a+x /usr/local/lsws/lsphp55/lib64/php/modules/imagick.so | + | pushd ~/tmp |
- | + | wget https://pecl.php.net/get/imagick-3.4.3.tgz | |
- | Lastly, edit your php.ini file to enable extension | + | tar -xf imagick-3.4.3.tgz |
- | extension=imagick.so | + | cd imagick-3.4.3 |
- | and restart LSWS. | + | /usr/local/lsws/lsphp70/bin/phpize |
+ | ./configure --with-php-config=/usr/local/lsws/lsphp70/bin/php-config7.0 | ||
+ | make | ||
+ | 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 |