Home  >  Article  >  Backend Development  >  Introducing the installation of php7 and php7 redis extension on ubuntu

Introducing the installation of php7 and php7 redis extension on ubuntu

coldplay.xixi
coldplay.xixiforward
2020-12-30 16:37:532992browse

PHP7The column introduces how to install php7 nginx mysql environment in ubuntu

Introducing the installation of php7 and php7 redis extension on ubuntu

Recommended (Free): PHP7

##1. First add nginx_signing.key:

wget http://nginx.org/keys/nginx_signing.key
sudo apt-key add nginx_signing.key
2. Install nginx:

sudo apt-get update
sudo apt-get install nginx
3. Install mysql:

sudo apt-get install mysql-server-5.6 mysql-client-5.6
4. Add PPA:

sudo apt-get install python-software-properties software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
5. Install php7 and php7 extensions

sudo apt-get install php7.0-fpm php7.0-mysql php7.0-common php7.0-curl php7.0-cli php7.0-mcrypt php7.0-mbstring php7.0-dom php7.0-gd php7.0-intl php-pear php-imagick php7.0-imap php-memcache  php7.0-pspell php7.0-recode php7.0-sqlite3 php7.0-tidy php7.0-xmlrpc php7.0-xsl php-gettext
6. Install php7redis extension:

cd /etc
wget https://github.com/phpredis/phpredis/archive/php7.zip -O phpredis.zip
unzip -o /etc/phpredis.zip && mv /etc/phpredis-* /etc/phpredis && cd /etc/phpredis && phpize  
./configure && make && sudo make install
above It seems to have been officially deleted. If it doesn't work, there is another way

cd /etc
sudo git clone https://github.com/nicolasff/phpredis  
cd phpredis  
sudo git checkout php7  
sudo /usr/local/php7/bin/phpize  
./configure --with-php-config=/usr/local/php7/bin/php-config  
make && make install
If the above is successful, enter extension=redis.so

in /etc/php/7.0/mods-available/redis.ini. The phpredis extension is connected to php7

sudo ln -s /etc/php/7.0/mods-available/redis.ini /etc/php/7.0/fpm/conf.d/redis.ini
sudo ln -s /etc/php/7.0/mods-available/redis.ini /etc/php/7.0/cli/conf.d/redis.ini
If it is apache, add extension=/tmp/phpredis/modules/redis.so

at the end of /etc/php/7.0/apache2/php.ini
Restart php and nginx

sudo service php7.0-fpm restart
sudo service nginx restart

The above is the detailed content of Introducing the installation of php7 and php7 redis extension on ubuntu. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:learnku.com. If there is any infringement, please contact admin@php.cn delete