Centos7下安装php7
通过编译的方式安装php7
1. 安装PHP7
## 下载 wget http://us2.php.net/distributions/php-7.0.2.tar.gz ## 安装 tar zxvf php-7.0.2.tar.gz cd php-7.0.2/ ./configure --help ## 查看安装的配置 ./configure --prefix=/usr/local/webserver/php --with-curl --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-xmlrpc --with-xsl --with-zlib --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-gd-native-ttf --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml --enable-zip --with-config-file-path=/etc make && make install cp php.ini-development /etc/php.ini cd /usr/local/webserver/php/etc && cp php-fpm.conf.default php-fpm.conf /sbin/chkconfig php-fpm on # 设置开机启动
2. 配置php.ini
extension_dir = "/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20151012/" date.timezone = prc enable_dl = On cgi.force_redirect = 0 cgi.fix_pathinfo=1 fastcgi.impersonate = 1 cgi.rfc2616_headers = 1 allow_url_fopen = On3. 测试安装,检测安装是否正确 4. 本次安装的收获 --with-config-file-path 参数指定的php.ini的位置,默认php.ini在php/lib目录下。如果要改变位置需要指定改参数 php.ini在php启动时读取,这样修改php.ini只要重启php即可,不需要重启nginx。配置文件