PHP7安装步骤
下载php7
官网地址:http://php.net/get/php-7.0.7.tar.bz2/from/a/mirror
安装依赖
分别安装
- apt-get install build-essential
- apt-get install openssl
- apt-get install curl
- apt-get install libcurl4-gnutls-dev
- apt-get install libjpeg-dev
- apt-get install libpng-dev
- apt-get install libmcrypt-dev
- apt-get install libreadline6 libreadline6-dev
- apt-get install pkg-config
- apt-get install libfreetype6-dev
一条命令
apt-get install build-essential openssl curl libcurl4-gnutls-dev libjpeg-dev libpng-dev libmcrypt-dev libreadline6 libreadline6-dev pkg-config libfreetype6-dev
configure
./configure --prefix=/usr/local/php7 --with-config-file-path=/usr/local/php7etc --enable-fpm --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-opcache --with-mysqli --with-mysql-sock --enable-pdo --with-pdo-mysql --with-gettext --enable-mbstring --with-iconv --with-mcrypt --with-mhash --with-openssl --enable-bcmath --enable-soap --with-libxml-dir --enable-pcntl --enable-shmop --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-sockets --with-curl --with-zlib --enable-zip --with-readline --without-sqlite3 --without-pdo-sqlite --with-pear --with-libdir=/lib/x86_64-linux-gnu --with-gd --with-jpeg-dir=/usr/lib --enable-gd-native-ttf --enable-xml --with-apxs2=/usr/local/apache2/bin/apxs
make
- make && make install
- 注意:如果make过了重新make一定要先make clean,否则会make失败
把配置文件拷过去
cp ./php.ini-production /usr/local/php7/etc/php.ini
环境变量配置
- 在etc/profile添加
- PATH=${PATH}:/usr/local/php/bin
- source /etc/profile
配置httpd
- LoadModule php7_module /usr/lib64/httpd/modules/libphp7.so
- <FilesMatch .php$>
- SetHandler application/x-httpd-php
-
</FilesMatch>