Linux centos7 安装 phpMyAdmin

yum install httpd php mariadb-server –y
搭建lamp运行环境之后安装phpMyAdmin遇到的一些问题记录一下

 

1.官网下载phpMyAdmin压缩包

wget -c https://files.phpmyadmin.net/phpMyAdmin/4.9.3/phpMyAdmin-4.9.3-all-languages.tar.gz

 

2.解压缩到/var/www/html/

tar -zxvf phpMyAdmin-4.9.3-all-languages.tar.gz -C /var/www/html/

 

3.重命名

cd /var/www/html/mv phpMyAdmin-4.9.3-all-languages phpMyAdmin

到这一步一般都可以正常通过localhost/phpMyAdmin访问了,但是有时候总会出现些其他问题。

 

4.进入到phpMyAdmin安装目录下复制phpmyadmin的简单配置文件config.sample.inc.php,作为默认配置文件config.inc.php

复制文件cp config.sample.inc.php config.inc.php编辑配置文件vim config.inc.php配置文件现在需要一个短语密码,找到$cfg[blowfish_secret] = ‘‘; //这里随意添加几个字符太短会有错误提示。$cfg[Servers][$i][auth_type] = cookie; //这里默认就好$cfg[Servers][$i][host] = localhost; //这里可以改为自己的ip地址或者域名,不改也没关系

 

5.如果出现错误提示

变量 $cfg[‘TempDir‘] (./tmp/)无法访问。phpMyAdmin无法缓存模板文件,所以会运行缓慢。

在phpMyAdmin目录下新建tmp文件夹mkdir tmpchmod 777 tmp

 

6.可能会提示缺少一些扩展程序

安装php链接数据库的扩展程序包yum install php-mysql安装支持多字节字符串扩展的程序包yum install php-mbstring -y安装支持多加密扩展的程序包yum install php-mcrypt –y

 

7.其他电脑访问需要开启80端口或关闭防火墙

开启80端口 firewall-cmd --zone=public --add-port=80/tcp --permanent//--zone作用域,--add-port=80/tcp添加端口/协议,--permanent永久生效重启防火墙systemctl restart firewalld或者干脆直接关闭防火墙查看防火墙状态systemctl status firewalld停止防火墙systemctl stop firewalld关闭开启启动防火墙systemctl disable firewalld

 

8.如果出现Forbidden提示没有权限访问,可能是被selinux阻止了

查看SELinux是否运行gettenforce如果是enforcing //强制模式,会限制domain/typepermissive //宽容模式,会有警告但不限制domain/typedisabled //关闭状态,没有运行settenforce 0 //转换成宽容模式,相当于临时关闭SELinuxxsettenforce 1 //转换成强制模式设置SELINUX=disables 可以设置开机不启动vim /etc/selinux/config

相关文章