1. The default path for installing PHP on Ubuntu16.04 using sudo apt-get install php7.1 is as follows:
A. PHP executable command:/usr/bin/php7.1 and/usr/bin/php
B. sudo apt install php7.1-dev is required to have/usr/bin/phpize, and/usr/bin/php-config. It will be used when installing the extension later.
C.. so file path:/usr/lib/php/20160303, this can be seen from the phpinfo ()
D. PHP *.ini configuration file directory:/ETC/PHP/7.1/with three directories
The mods-available directory holds the INI configuration for various loadable PHP extensions, and after installing the Redis extension, add the Redis.ini file here
The CLI/CONF.D directory contains extensions that PHP has loaded in command-line mode, with filenames such as: 20-redis.ini
The APACHE2/CONF.D directory holds the extensions that have been loaded in Web mode, such as the file name: 10-pdo.ini This can be seen from the phpinfo () to see the path of the various INI files loaded
The N-###.ini in the CLI/CONF.D and APACHE2/CONF.D directories do not need to be created, directly from the mods-available soft link. The number in the file name represents the priority level
2. Install the Redis extension for PHP:
A. Website address Http://pecl.php.net/package/redis, right-click on redis-4.0.1.tgz to copy the link address
B. Use wget http://pecl.php.net/get/redis-4.0.1.tgz in Ubuntu to download to the current directory
C. TAR-ZXVF redis-4.0.1.tgz extract to current directory
D. CD redis-4.0.1
E. Execute phpize (if you do not have this command, see item B of the first section)
F../configure--with-php-config=/usr/bin/php-config
G. Make
H. Make Install
The redis.so file is now automatically added to the/usr/lib/php/20160303 directory
I. Create a Redis.ini file in the/etc/php/7.1/mods-available directory, write a line extension=redis.so
J. Creating a soft link sudo ln-s/etc/php/7.1/mods-available/redis.ini/etc/php/7.1/cli/conf.d/20-redis.ini, at this time/etc/php/7.1/cli/ There are 20-redis.ini files in the CONF.D directory
K. Create a soft link sudo ln-s/etc/php/7.1/mods-available/redis.ini/etc/php/7.1/apache2/conf.d/20-redis.ini, at which point/ETC/PHP/7.1/ There are 20-redis.ini files in the APACHE2/CONF.D directory
L. Restart Apache:sudo/etc/init.d/apache2 Restart
M. Refresh the Phpinfo page now to see that the Redis extension is loaded
PHP7.1 installation path and Redis extension installation on Ubuntu