(8) PHP dynamic expansion module installation

PHP dynamic expansion module installation

  • Now our PHP has been installed. At this time, we found that there is a lack of a module. We can't recompile PHP. So this article mainly discusses how to install PHP module with dynamic expansion module
  • See which modules are loaded in php
/usr/local/php/bin/php -m

Install a redis extension module of php

1. Download the source package and unzip it

#Enter the download directory
[root@centos001 ~]# cd /usr/local/src/
#download
[root@centos001 src]# wget https://codeload.github.com/phpredis/phpredis/zip/develop
#Rename
[root@centos001 src]# mv develop phpredis-develop.zip
#decompression
[root@centos001 src]# unzip phpredis-develop.zip
#Enter the file directory
[root@centos001 src]# cd phpredis-develop
  • Error: generate configure file to report error
[root@centos001 phpredis-develop]# /usr/local/php/bin/phpize
Configuring for:
PHP Api Version:         20131106
Zend Module Api No:      20131226
Zend Extension Api No:   220131226
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

2. Install the yum package and generate the file again

[root@centos001 phpredis-develop]# yum install -y autoconf
[root@centos001 phpredis-develop]# /usr/local/php/bin/phpize
Configuring for:
PHP Api Version:         20131106
Zend Module Api No:      20131226
Zend Extension Api No:   220131226

3. Configure compilation parameters

[root@centos001 phpredis-develop]# ./configure --with-php-config=/usr/local/php/bin/php-config
[root@centos001 phpredis-develop]# echo $?
0

4. Compile and install

[root@centos001 phpredis-develop]# make && make install
[root@centos001 phpredis-develop]# echo $?
0

5. View the storage directory of the expansion module

[root@centos001 phpredis-develop]# /usr/local/php/bin/php -i |grep extension_dir
 #The following list is a warning. It doesn't appear when you set the php7 directory in the video. If you want to remove it, you can set the timezone parameter in php.ini
PHP Warning:  Unknown: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Unknown on line 0
extension_dir => /usr/local/php/lib/php/extensions/no-debug-zts-20131226 => /usr/local/php/lib/php/extensions/no-debug-zts-20131226
sqlite3.extension_dir => no value => no value

6. Modify the configuration file

#You can see redis.so, but it is not loaded here
[root@centos001 phpredis-develop]# ls /usr/local/php/lib/php/extensions/no-debug-zts-20131226
opcache.so  redis.so
#Enter profile
#Add the following to the module
extension = redis.so

7. Check whether the module is loaded

[root@centos001 phpredis-develop]# vim /usr/local/php/etc/php.ini 
[root@centos001 phpredis-develop]# /usr/local/php/bin/php -m |grep redis
redis

extend

apache rewrite tutorial http://coffeelet.blog.163.com/blog/static/13515745320115842755199/
http://www.cnblogs.com/top5/archive/2009/08/12/1544098.html
apache rewrite has a dead cycle http://ask.apelearn.com/question/1043
php error log level reference http://ask.apelearn.com/question/6973
php open short label http://ask.apelearn.com/question/120
php.ini details http://legolas.blog.51cto.com/2682485/493917

Tags: PHP Redis yum Apache

Posted on Sun, 05 Jan 2020 18:56:38 -0800 by jawinn