Centos 6.5 在线Install php70,centosphp70
配置在线php YUM源环境依赖
yum install libcgroup audit-libs-python environment-modules policycoreutils-python setools-libs-python setools-libs tcl policycoreutils httpd -y
进入目录
cd /etc/yum.repo
创建php源
vim remi-php70.repo
# This repository only provides PHP 7.0 and its extensions
# NOTICE: common dependencies are in "remi-safe"
[remi-php70]
name=Remi's PHP 7.0 RPM repository for Enterprise Linux 6 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/6/php70/$basearch/
mirrorlist=http://rpms.remirepo.net/enterprise/6/php70/mirror
enabled=0
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
[remi-php70-debuginfo]
name=Remi's PHP 7.0 RPM repository for Enterprise Linux 6 - $basearch - debuginfo
baseurl=http://rpms.remirepo.net/enterprise/6/debug-php70/$basearch/
enabled=0
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
[remi-php70-test]
name=Remi's PHP 7.0 test RPM repository for Enterprise Linux 6 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/6/test70/$basearch/
mirrorlist=http://rpms.remirepo.net/enterprise/6/test70/mirror
enabled=0
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
[remi-php70-test-debuginfo]
name=Remi's PHP 7.0 test RPM repository for Enterprise Linux 6 - $basearch - debuginfo
baseurl=http://rpms.remirepo.net/enterprise/6/debug-test70/$basearch/
enabled=0
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
================================================================================================================================================
配置remi-safe
vim remi-safe.repo
# This repository is safe to use with RHEL/CentOS base repository
# it only provides additional packages for the PHP stack
# all dependencies are in base repository or in EPEL
[remi-safe]
priority=10
name=Safe Remi's RPM repository for Enterprise Linux 6 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/6/safe/$basearch/
mirrorlist=http://rpms.remirepo.net/enterprise/6/safe/mirror
enabled=0
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
~
安装php70
yum --enablerepo=remi-safe -y install php70
安装httpd
yum install httpd -y
启动httpd
service httpd start
查看版本
php71 -v
负载环境变量与SCL的工具
scl enable php70 bash
查看版本
php -v
PHP 7自动登录时,配置如下
vi /etc/profile.d/php70.sh
# create new
#!/bin/bash
source /opt/remi/php70/enable
export X_SCLS="`scl enable php70 'echo $X_SCLS'`
安装php70 配置 Apache httpd
重命名和禁用如果老版本存在重命名和禁用如果老版本存在
mv /etc/httpd/conf.d/php70-php.conf /etc/httpd/conf.d/php.conf.org
重启httpd
service httpd restart
创建phpinfo进行工作
echo '<?php phpinfo(); ?>' > /var/www/html/info.php
创建测试页
curl http://localhost/info.php | grep 'PHP Version' | tail -1 | sed -e 's/<[^>]*>//g'
网页测试
http://192.168.31.66/info.php
PHP之友评论