Ubuntu系统安装PHP7

#1、删除旧版本

apt-get remove php-common

#2、下载php7

wget http://cn2.php.net/get/php-7.1.10.tar.bz2/from/this/mirror
tar xvf mirror
cd php-7.1.10

#3、编译配置

./configure --prefix=/usr --with-config-file-path=/etc/php/7.1/cli/ --with-config-file-scan-dir=/etc/php/7.1/cli/conf.d --enable-mbstring --enable-zip --enable-bcmath --enable-pcntl --enable-ftp --enable-exif --enable-calendar --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --with-curl --with-mcrypt --with-iconv --with-gmp --with-pspell --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-zlib-dir=/usr --with-xpm-dir=/usr --with-freetype-dir=/usr --enable-gd-native-ttf --enable-gd-jis-conv --with-openssl --with-pdo-mysql=/usr --with-gettext=/usr --with-zlib=/usr --with-bz2=/usr --enable-fpm --with-pcre-jit --with-pcre-regex --with-pear --config-cache --sysconfdir=/etc

#4、测试编译有没有异常

make
make test

#5、安装

sudo make install

#6、配置文件

cp php.ini-production /etc/php.ini
cp sapi/fpm/php-fpm.conf /etc/php-fpm.conf
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
mkdir /etc/php-fpm.d/
cp sapi/fpm/www.conf /etc/php-fpm.d/

#7、安装pear

curl -O http://pear.php.net/go-pear.phar
sudo php -d detect_unicode=0 go-pear.phar

#8、安装扩展

pecl install yaf
pecl install mongodb
pecl install redis
pecl install msgpack

#9、安装composer

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/bin/

发表评论