The correct installation method of php extension under linux: 1. Download and decompress the extension file; 2. Enter the decompression 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:
//Download files #wget http://pecl.php.net/get/zip-1.12.4.tgz //unzip files #tar zxfv zip-1.12.4.tgz //Enter the decompressed file directory #cd zip-1.12.4 //Check the system configuration and start configuration, specify the configuration when installing PHP #./configure --with-php-cOnfig=/usr/local/php-5.2.17/bin/php-config //compile #make //test #make test //Install #make install
Method 2: pecl installation
Concrete steps:
1. First check whether there is pecl under /usr/local/php/bin/ , pear (php-pear is installed to use phpize in pecl) if not, install with yum
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 path of php to the environment variable, you need to use the absolute address
4. Generally, extensions installed through pecl are automatically added to the configuration of php.ini. If no extensions are found through phpinfo() or php-m, add the corresponding so file to php.ini (extension=redis.so) and then restart php-fpm