PHP7欄位介紹ubuntu如何安裝php7 nginx mysql環境
推薦(免費):PHP7
1、先加入nginx_signing.key:
wget http://nginx.org/keys/nginx_signing.key sudo apt-key add nginx_signing.key
2、安裝nginx:
sudo apt-get update sudo apt-get install nginx
3、安裝mysql:
sudo apt-get install mysql-server-5.6 mysql-client-5.6
4、新增PPA:
sudo apt-get install python-software-properties software-properties-common sudo add-apt-repository ppa:ondrej/php sudo apt-get update
5、安裝php7和php7的擴充功能
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.安裝php7redis擴充:
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
上面好像被官方刪掉了,如果不行還有一種方法
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
如果上面成功的話在/etc/php/7.0/mods-available/redis.ini裡輸入extension=redis.so
將phpredis擴充連接到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
如果是apache要在/etc/php/7.0/apache2/php.ini最後加入extension=/tmp/phpredis/modules/redis.so
重啟php和nginx
sudo service php7.0-fpm restart sudo service nginx restart
以上是介紹ubuntu安裝php7和php7的redis擴展的詳細內容。更多資訊請關注PHP中文網其他相關文章!