您的位置:首页 > 运维架构 > Linux

Centos 6.5 在线Install php71

2016-12-01 16:02 204 查看
配置在线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-php71.repo

# This repository only provides PHP 7.1 and its extensions

# NOTICE: common dependencies are in "remi-safe"

[remi-php71]

name=Remi's PHP 7.1 RPM repository for Enterprise Linux 6 - $basearch

#baseurl=http://rpms.remirepo.net/enterprise/6/php71/$basearch/

mirrorlist=http://rpms.remirepo.net/enterprise/6/php71/mirror

enabled=0

gpgcheck=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

[remi-php71-debuginfo]

name=Remi's PHP 7.1 RPM repository for Enterprise Linux 6 - $basearch - debuginfo

baseurl=http://rpms.remirepo.net/enterprise/6/debug-php71/$basearch/

enabled=0

gpgcheck=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

[remi-php71-test]

name=Remi's PHP 7.1 test RPM repository for Enterprise Linux 6 - $basearch

#baseurl=http://rpms.remirepo.net/enterprise/6/test71/$basearch/

mirrorlist=http://rpms.remirepo.net/enterprise/6/test71/mirror

enabled=0

gpgcheck=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

[remi-php71-test-debuginfo]

name=Remi's PHP 7.1 test RPM repository for Enterprise Linux 6 - $basearch - debuginfo

baseurl=http://rpms.remirepo.net/enterprise/6/debug-test71/$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

~                                                 

安装php71

yum --enablerepo=remi-safe -y install php71

查看版本

php71 -v

安装httpd

yum install httpd -y

启动httpd

service httpd start

负载环境变量与SCL的工具

scl enable php71 bash

查看版本

php -v

PHP 7自动登录时,配置如下

vi /etc/profile.d/php71.sh

# create new

#!/bin/bash

source /opt/remi/php71/enable

export X_SCLS="`scl enable php71 'echo $X_SCLS'`"

安装php71 配置 Apache httpd

yum --enablerepo=remi-safe -y install php71-php

重命名和禁用如果老版本存在重命名和禁用如果老版本存在

mv /etc/httpd/conf.d/php71-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
   
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: