1. 程式人生 > >phpMyAdmin安裝記錄

phpMyAdmin安裝記錄

phpmyadmin

phpMyAdmin安裝記錄


時間:2017年9月20日


一、phpMyAdmin簡介:

phpMyAdmin,是MySQL或MariaDB數據庫的GUI管理工具,以php為基礎,以web為工作形式。


二、phpMyAdmin安裝:

2-1:LAMP環境準備

IP:192.168.1.71;

Hostname:centos73-2.surmount.net;

Linux:CentOS Linux release 7.3.1611 (Core);

Apache:httpd-2.4.6;

Mysql:Ver 15.1 Distrib 5.5.52-MariaDB;

PHP:ISO光盤yum源初始安裝為php-5.4.16,

在安裝phpMyAdmin-4.7.4報錯提示後按需要升級為php56w-5.6.31。


2-1-1:安裝及配置MariaDB

# yum install mariadb-server -y
# systemctl start mariadb.service
# mysql
MariaDB [(none)]> SET PASSWORD FOR ‘root‘ @‘127.0.0.1‘=PASSWORD(‘jingpei‘);
MariaDB [(none)]> SET PASSWORD FOR ‘root‘ @‘localhost‘=PASSWORD(‘jingpei‘);
MariaDB [(none)]> FLUSH PRIVILEGES;

//設置DB的root用戶密碼


2-1-2:安裝及配置Apache

# yum install httpd -y
# systemctl start httpd.service
# vim /etc/httpd/conf/httpd.conf
ServerName centos73-2.surmount.net:80
# httpd -t
Syntax OK
# systemctl reload httpd.service

http://192.168.1.71

//測試html頁面

OK


2-1-3:安裝PHP

# yum install php php-mysql -y
# vim /var/www/html/index.php
<?php
        $link = mysql_connect(‘localhost‘, ‘mysql‘, ‘‘);
        if (!$link)
        {
                die(‘Could not connect: ‘ . mysql_error());
        }
        echo ‘Connected successfully‘;
        mysql_close($link);
        phpinfo()
?>

http://192.168.1.71/index.php

//測試php頁面,測試DB連接

OK


2-2:安裝phpMyAdmin

2-2-1:安裝

# unzip phpMyAdmin-4.7.4-all-languages.zip
# cp -a phpMyAdmin-4.7.4-all-languages /var/www/html
# ln -sv phpMyAdmin-4.7.4-all-languages pma
# cd /var/www/html/pma
# cp config.sample.inc.php config.inc.php
# tr -d ‘a-zA-Z0-9‘ < /dev/urandom | head -30 | md5sum
8b2c0e4f280fb8cab9ff8b2716cf7a40  -
# vim config.inc.php
......
$cfg[‘blowfish_secret‘] = ‘8b2c0e4f280fb8cab9ff8b2716cf7a40‘; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
......
http://192.168.1.71/pma
status code:500

2-2-1:排錯

# vim /etc/php.ini
......
display_errors
Default Value: On
......
error_reporting
Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
......

//開啟PHP報錯

# systemctl reload httpd.service
http://192.168.1.71/pma/
Parse error: syntax error, unexpected ‘@‘ in /var/www/html/phpMyAdmin-4.7.4-all-languages/libraries/common.inc.php on line 467
# cat /var/www/html/pma/libraries/common.inc.php
467 if (@extension_loaded(‘mbstring‘) && !empty(@ini_get(‘mbstring.func_overload‘))) {
468     PMA_fatalError(
469         __(
470             ‘You have enabled mbstring.func_overload in your PHP ‘
471             . ‘configuration. This option is incompatible with phpMyAdmin ‘
472             . ‘and might cause some data to be corrupted!‘
473         )
474     );
475 }
# wget -O /etc/yum.repos.d/CentOS-Base-Ali.repo http://mirrors.aliyun.com/repo/Centos-7.repo
# sed -i  ‘s/$releasever/7/g‘ /etc/yum.repos.d/CentOS-Base-Ali.repo
# yum install php-mbstring -y
# systemctl reload httpd.service
http://192.168.1.71/pma/

//提示錯誤相同,暫時註釋掉common.inc.php的467-475行,待完成php升級後再取消註釋。

# systemctl reload httpd.service

http://192.168.1.71/pma/

PHP 5.5+ is required.

Currently installed version is: 5.4.16

//提示php版本低

# yum list installed | grep php
php.x86_64                              5.4.16-42.el7                  @iso     
php-cli.x86_64                          5.4.16-42.el7                  @iso     
php-common.x86_64                       5.4.16-42.el7                  @iso     
php-mbstring.x86_64                     5.4.16-42.el7                  @base    
php-mysql.x86_64                        5.4.16-42.el7                  @iso     
php-pdo.x86_64                          5.4.16-42.el7                  @iso 
# yum remove php php-cli php-common php-mbstring php-mysql php-pdo -y
# yum list php*

//無可用源,故安裝webtatic第三方yum源

# rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
# yum install php56w -y
# systemctl reload httpd.service

http://192.168.1.71/pma/

//缺少mbstring擴展

# wget http://repo.webtatic.com/yum/el7/x86_64/RPMS/php56w-mbstring-5.6.31-1.w7.x86_64.rpm
# rpm -ivh php56w-mbstring-5.6.31-1.w7.x86_64.rpm
# systemctl reload httpd.service

http://192.168.1.71/pma/

//缺少mysqli擴展

# yum install php56w-mysql -y
# systemctl reload httpd.service
# httpd -M | grep php
php5_module (shared)

http://192.168.1.71/pma/

OK

技術分享

完成安裝,基於鼠標流的操作不再敖述。







本文出自 “你好,CTO。” 博客,請務必保留此出處http://200622925.blog.51cto.com/13331171/1967656

phpMyAdmin安裝記錄