Centos7 yum安装php5.6+apache2.4.7+mysql5.6

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Centos7 yum安装php5.6+apache2.4.7+mysql5.6相关的知识,希望对你有一定的参考价值。

简言:

使用yum安装php5.6+apache2.4.7+mysql5.6

环境:Centos7

 

一、安装Apache

yum install -y httpd
httpd -v  //查看版本信息

 

二、安装PHP5.6

yum -y install epel-release    //安装epel-release
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum -y install php56w php56w-mysql php56w-gd libjpeg* php56w-ldap php56w-odbc php56w-pear php56w-xml php56w-xmlrpc php56w-mbstring php56w-bcmath 
yum -y install httpd php-gd56w php-intl56w php-mysql56w mod_ssl openssl mcrypt php5-mcrypt56w
yum -y install php56w-mcrypt php56w-soap php56w-intl  php56w-pdo
systemctl restart httpd.service
php -v  //查看版本信息

 

 

三、安装Mysql5.6

卸载mariadb,否则安装mysql会出现冲突
rpm -qa | grep mariadb
(rpm -e --nodeps 包名称(比如:rpm -e --nodeps mariadb-libs-5.5.44-2.el7.centos.x86_64))

创建并编辑mysql-community.repo文件
执行命令:vi /etc/yum.repos.d/mysql-community.repo
[mysql56-community]
name=MySQL 5.6 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/7/$basearch/
enabled=1
gpgcheck=0    //gpgcheck是GPG加密校验,官方文档中,值为1,但check会报错误,所以这里改为0跳过检查,对安装无影响
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
sudo yum install mysql-community-server
sudo service mysqld start
mysqladmin -u root -p password 你的新密码

 

 

测试

cd /var/www/html/

vi index.php

<?php
    echo phpinfo();
?>

浏览器打开本机IP地址

 

 访问成功!!!

以上是关于Centos7 yum安装php5.6+apache2.4.7+mysql5.6的主要内容,如果未能解决你的问题,请参考以下文章

centos7.4 编译安装php5.6 (LNMP)

centos7更新php5.4到php5.6/php7

linux centos7环境下安装apache2.4+php5.6+mysql5.6 安装及踩坑集锦

CentOS 7 yum 安装php5.6

CentOS 7 yum 安装php5.6

linux配置LAMP(CentOS7.4 Apache2.4 PHP5.6)