Home>Article>Backend Development> How to install php extension under linux
The method to install php extensions under Linux is: it can be achieved by compiling and installing. Specific methods: 1. Execute the wget command to download the file and decompress it; 2. Enter the decompression directory and perform relevant configurations; 3. Execute the make command to compile and install.
There are usually two installation methods on Linux:
(Recommended tutorial:php tutorial)
1. Compile and install
Specific steps:
//下载文件 #wget http://pecl.php.net/get/zip-1.12.4.tgz //解压文件 #tar zxfv zip-1.12.4.tgz //进入到解压文件目录 #cd zip-1.12.4 //检查系统配置开始配置,指定安装 PHP 的时候的配置 #./configure --with-php-config=/usr/local/php-5.2.17/bin/php-config //编译 #make //测试 #make test //安装 #make install
2. Install in pecl way
1. First check if there is pecl under /usr/local/php/bin/ , pear (php-pear is installed to use phpize in pecl) if not, use yum to install (yum install php-pear,php-devel);
2. Update the pecl library pecl channel-update pecl.php.net;
3. Install the corresponding extension pecl install redis (if the path to php is not added to the environment variable, you need to use an absolute address);
4. Generally, through pecl The installed extensions are automatically added to the php.ini configuration. If the installed extension is not found through phpinfo() or php-m, add the corresponding so file to php.ini (extension=redis.so) and restart php-fpm.
The above is the detailed content of How to install php extension under linux. For more information, please follow other related articles on the PHP Chinese website!