官网下载tag包
php编译安装包 官网下载地址
- linux下面执行命令下载
wget http://cn.php.net/distributions/php-7.1.25.tar.gz
- 解压
tar -zxvf php-7.1.25.tar.gz
- 加载依赖包
yum install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel
- 编译
./configure --prefix=/usr/local/php7 --with-config-file-path=/usr/local/php7/etc --with-gd --with-curl --enable-fpm --enable-mbstring --enable-zip --with-mcrypt --with-openssl --with-freetype-dir --enable-gd-native-ttf --enable-mysqlnd --with-pdo-mysql=mysqlnd
- 安装
make && make install
- 将php7目录php.ini-development复制到/usr/local/php7/etc目录中,并命名php.ini
cp php.ini-development /usr/local//php7/etc/php.ini
- 将php/etc中php-fpm.conf.default复制成php-fpm.conf和php-fpm.d中www.conf.default复制成www.conf
cp php-fpm.conf.default php-fpm.conf
cp www.conf.default www.conf
- 将php-fpm.conf文件中error_log前面;删除
error_log=/usr/local/php/var/log/php-fpm.log
- 编辑 php-fpm.d下面的www.conf,将部分字段改为下面所示
listen = /dev/shm/php7-cgi.sock (sock模式)
listen = 127.0.0.1:9000 (端口模式)
listen.owner = www
listen.group = www
listen.mode = 0666
user = www
group = www
- 启动php-fpm服务
./sbin/php-fpm
- 常见问题
Call to undefined function curl_init()
这个是由于安装时没有带上 --with-curl 安装curl拓展,可以尝试重新安装,或者单独安装curl
Call to undefined method Illuminate\Support\Facades\Redis:
这个是没有安装redis拓展
具体操作
下载redis拓展 网址http://pecl.php.net/package/redis
wget http://101.96.10.64/pecl.php.net/get/redis-3.1.3.tgz
解压
tar zxvf redis-3.1.3.tgz
进入解压目录
cd redis-3.1.3
执行phpize命令
/usr/local/php7/bin/phpize
./configure --with-php-config=/usr/local/php7/bin/php-config
make && make install
添加拓展到php.ini文件
vim /usr/local/php7/etc/php.ini
#添加extension = redis.so
查看是否支持redis
php -m