Installation of php extension under linux system

0. Here is an example of installing redis extension in php

1. First download and unzip the redis extension package

[root@xxx ~]# cd /usr/local/src
[root@xxx src]# wget https://codeload.github.com/phpredis/phpredis/zip/develop
[root@xxx src]# unzip develop

2. View the path where the phpize and php-config tools are located

[root@xxx src]# find / - name phpize Note: My phpize path is in /usr/local/bin/phpize
[root@xxx src]# find / -name php-config Note: my php-config path /usr/local/php/bin/php-config

3. Start compiling the redis extension package

[root@xxx src]# cd phpredis-develop
[root@xxx phpredis -develop]# /usr/local/php/bin/ phpize Note: Generate configure file
[root@xxx phpredis -develop]# ./configure -with-php-configure=/usr/local/php/bin/php-config Note: Generate compilable files 
[root@xxx phpredis-develop]# make && make install Note: Generate redis.so extension file

4. Add the path to the extension file in the php.ini file

[root@xxx phpredis-develop]# find / - name php.ini Note: My php.ini path is in /etc/php.ini
[root@xxx phpredis-develop]# vim /etc/php.ini

5. Check if the extension is installed successfully

[root@xxx phpredis-develop]# php -m

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325366611&siteId=291194637