Home > Operation and Maintenance > Linux Operation and Maintenance > How to correctly install php extensions under linux

How to correctly install php extensions under linux

王林
Release: 2020-11-06 14:33:56
Original
2413 people have browsed it

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.

How to correctly install php extensions under linux

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
Copy after login

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
Copy after login

2. Update the pecl library

pecl channel-update pecl.php.net
Copy after login

3. Install the corresponding extension

pecl install redis
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template