Phpmyadmin-4.0.10.20 安装配置

PMA网站
http://www.phpmyadmin.net/home_page/downloads.php

 

一.安装Phpmyadmin-4.0.10.20

[root@Zabbixserver shenjianyu]# pwd
/home/shenjianyu

[root@Zabbixserver shenjianyu]#  tar -zxvf phpMyAdmin-4.0.10.20-all-languages.tar.gz

[root@Zabbixserver shenjianyu]# cp -rp phpMyAdmin-4.0.10.20-all-languages /var/www/pma  (前提:要安装Apache)

[root@Zabbixserver shenjianyu]# cd /var/www/pma/

 

如果你下载的是最新版本,需要做这一步,我暂时没有做

[root@Zabbixserver pma]# cp config.sample.inc.php config.inc.php

新版本的PhpMyAdmin 增强了安全性,需要在配置文件设置一个短语密码。
否则进入之后会有“配置文件现在需要一个短语密码。”的红色警叹提示
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['blowfish_secret'] = 'abcde';(其中的"abcde"自定义)
这个密码用于Cookies的加密,以免多个PhpMyAdmin或者和其他程序共用Cookies时搞混

 

二.配置Apache

配置apache,加入如下配置

[root@Zabbixserver pma]# vim /etc/httpd/conf/httpd.conf 

  Alias /pma "/var/www/pma/"
  < Directory "/var/www/pma/">
    Order allow,deny
    Allow from all
    Options -Indexes FollowSymLinks
    AllowOverride All
  < /Directory>

 

新建一個帶密碼的本地帳戶

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY "123456" WITH GRANT OPTION;

 

 

三.排错

①一般安裝完,會有這個提示

解决办法:

[root@Zabbixserver php.d]# yum install php-mbstring

[root@Zabbixserver php.d]# /etc/init.d/httpd stop
[root@Zabbixserver php.d]# /etc/init.d/httpd start

 

提示“无法载入mcrypt扩展,请检查PHP配置”
網上的辦法無非就是重裝下php 帶上 --with-mcrypt參數
但是總覺得這種方法太笨重
所以仔細看了php官方網站,找到了用phpize來安裝mcrypt
You can install Mcrypt from the PHP Source Tree as a module if you choose.

You first need to ensure you have libmcrypt, libmcrypt-devel, and mcrypt installed, then do:

[root@Zabbixserver pma]# cd  /shenjianyu/php-5.5.35/ext/mcrypt/
[root@Zabbixserver pma]#  phpize  ( 如果没有这个命令,yum install php-devel.i686 )

[root@Zabbixserver ext]# whereis phpize  

phpize: /usr/bin/phpize /usr/share/man/man1/phpize.1.gz

 

[root@Zabbixserver mcrypt]# phpize

[root@Zabbixserver mcrypt]# aclocal
[root@Zabbixserver mcrypt]# ./configure
[root@Zabbixserver mcrypt]# make && make install

如果make时报错:

/bin/sh /shenjianyu/php-5.5.35/ext/mcrypt/libtool --mode=compile cc -I. -I/shenjianyu/php-5.5.35/ext/mcrypt -DPHP_ATOM_INC -I/shenjianyu/php-5.5.35/ext/mcrypt/include -I/shenjianyu/php-5.5.35/ext/mcrypt/main -I/shenjianyu/php-5.5.35/ext/mcrypt -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /shenjianyu/php-5.5.35/ext/mcrypt/mcrypt.c -o mcrypt.lo 

libtool: compile: cc -I. -I/shenjianyu/php-5.5.35/ext/mcrypt -DPHP_ATOM_INC -I/shenjianyu/php-5.5.35/ext/mcrypt/include -I/shenjianyu/php-5.5.35/ext/mcrypt/main -I/shenjianyu/php-5.5.35/ext/mcrypt -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /shenjianyu/php-5.5.35/ext/mcrypt/mcrypt.c -fPIC -DPIC -o .libs/mcrypt.o
/shenjianyu/php-5.5.35/ext/mcrypt/mcrypt.c:283: error: ‘PHP_FE_END’ undeclared here (not in a function)
‘PHP_FE_END’未声明(不在函数内) -----{error: ‘PHP_FE_END’ undeclared here (not in a function)}

 


解决方法: 源代码有错误,进入PHP-5.3.18/ext/mcrypt目录

sed -i 's|PHP_FE_END|{NULL,NULL,NULL}|' ./*.c
sed -i 's|ZEND_MOD_END|{NULL,NULL,NULL}|' ./*.c

 


再重新make && make install

如果提示:

Enable the module by adding: 'extension=mcrypt.so' to PHP.ini.

Done!

那就是成功了

 

# vi /etc/php.ini
搜索[mcrypt]
在這行下添加

extension=mcrypt.so

 


# service httpd restart
如果出錯將所有httpd進程killall httpd後,再開啟

 

在浏览器输入http://IP/pma

输入之前授权的数据库账号 密码即可

 

如果想要通过phpMyAdmin查看其他机器数据库

1.先在对应机器上授权你server ip的账号密码

2.修改/var/www/pma/config.inc.php的这一行

 $cfg['Servers'][$i]['host'] = '192.168.1.185';

重启即可

 

感谢http://www.ttlsa.com/php/phpmyadmin-3-4-8-install/

posted @ 2017-04-01 17:14  沈剑宇  阅读(1095)  评论(0编辑  收藏  举报