Home > Article > Operation and Maintenance > How to correctly install php extensions under linux
The correct installation method of PHP extension under Linux: 1. Download and decompress the extension file; 2. Enter the decompressed file directory and check the system configuration; 3. Execute the [make && make install] command to install the extension.
Method 1: Compile and install
(Learning video recommendation: linux video tutorial)
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
Method 2: pecl installation
Specific steps:
1. First check whether there is pecl or pear under /usr/local/php/bin/ (Installing php-pear is 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 you do not add the php path to the environment variable, you need to use the absolute address
4. Generally, extensions installed through pecl are automatically added to the php.ini configuration. If you use phpinfo() or If php-m does not query the installed extension, add the corresponding so file to php.ini (extension=redis.so) and restart php-fpm
Related recommendations: php training
The above is the detailed content of How to correctly install php extensions under linux. For more information, please follow other related articles on the PHP Chinese website!