參考資料:

安裝 phpMyAdminMySQL 的網頁版圖形操作介面)

Linux + Apache + MySQL - PHP 安裝過程記錄 (LAMP)

 

一般來說從 yum install myadmin 指令來安裝即可,但是以我自己在用的 Centos 6 的版本來說,官方的套件庫內並沒有 phpmyadmin 了!因此我是自己採手動安裝的方式。

 

官方網站:

http://www.phpmyadmin.net

http://www.phpmyadmin.net/home_page/downloads.php

 

下載檔案後先丟到任一個使用者家目錄內

(假設將檔案路徑為 /var/www/html/phpMyAdmin-4.0.4.2-all-languages.tar.gz

 

解壓縮

# cd /var/www/html/

# tar -zxvf phpMyAdmin-4.0.4.2-all-languages.tar.gz

 

目錄名稱太長,我們先修改一下目錄名稱

# mv phpMyAdmin-4.0.4.2-all-languages.tar.gz phpMyAdmin

 

預設情況下有一個設定範例檔 config.sample.inc.php 我們複製一份並且命名為 config.inc.php

# cd phpMyAdmin

# cp config.sample.inc.php config.inc.php

 

設定 phpMyAdmin

# vi config.inc.php

 

找到以下這行

 

$cfg['Servers'][$i]['auth_type'] = 'cookie';

cookie 改成 http 這樣一來就可以透過瀏覽器使用 phpMyAdmin 操作

 

http://您的網址/~使用者名稱/phpMyAdmin

 

登入後會詢問帳號密碼,就請輸入您當初設定的 MySQL 帳號跟密碼

 

 

關於 MySQL 的安裝請參考此篇文章:

Linux + Apache + MySQL - PHP 安裝過程記錄 (LAMP)

 

順利進入網頁後發現底下出現了一些錯誤訊息

phpMyAdmin 高級功能未全部設定,部分功能不可用。要查出原因請點這裡。

沒有找到 PHP 外掛 mbstring,而您現在好像在使用多字元字集。沒有 mbstring 擴展的 phpMyAdmin 不能正確分割字元串,可能產生意想不到的結果

缺少 mcrypt 外掛。請檢查 PHP 設定

You are using an incomplete translation, please help to make it better by <a href="http://www.phpmyadmin.net/home_page/improve.php#translate" target="_blank">contributing</a>.

先來看比較重要的兩個紅色的錯誤訊息部分,基本上就是缺少了 mbstring mcrypt 這兩個 PHP 外掛,透過 yum 來安裝:

 

# yum install php-mbstring

 

但是 mcrypt 並沒有在官方的套件庫裡面,沒辦法使用 yum 來安裝,所以查詢了一下解決方式,就是使用 Extra Packages for Enterprise Linux

參考 EPEL - FedoraProject 官網 http://fedoraproject.org/wiki/EPEL

 

指令安裝下列epel rpm

32位元:

rpm -ivh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

 

64位元:

rpm -ivh http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm

 

上述根據伺服器版本擇一安裝,系統安裝完畢後接著輸入底下指令

# yum update

# yum install php-mcrypt

# /etc/rc.d/init.d/httpd restart

 

如果安裝完後,如果想要把 EPEL 關掉,可以去設定

# vi /etc/yum.repos.d/epel.repo

enabled=1 改為 enabled=0 這樣即可

 

解決無法讀取 mcrypt 模組的問題

明明已經用 yum 安裝 php-mcrypt 了,在登入 phpMyAdmin 時,卻出現了錯誤訊息:

無法讀取 mcrypt 模組, 請檢查 PHP 設定

執行 php -v ,也出現:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/module.so' - /usr/lib64/php/modules/module.so: cannot open shared object file: No such file or directory in Unknown on line 0
; Enable mcrypt extension module

 /usr/lib64/php/modules/ 查看,確實沒有 "module.so",倒是有一個  "mcrypt.so"

解決方法

編輯 /etc/php.d/mcrypt.ini,將第 2 行的:

extension=module.so

改成:

extension=mcrypt.so

再重新啟動 Apache 就好了:

# /etc/rc.d/init.d/httpd restart

進入phpmyadmin後,出現了這個問題:

 

點這裡之後出現的錯誤訊息如下:

 


$cfg['Servers'][$i]['pmadb'] ...

錯誤 [ 文件 ]

$cfg['Servers'][$i]['relation'] ...

錯誤 [ 文件 ]

一般關聯功能已停用

 

 

$cfg['Servers'][$i]['table_info'] ...

錯誤 [ 文件 ]

顯示功能已停用

 

 

$cfg['Servers'][$i]['table_coords'] ...

錯誤 [ 文件 ]

$cfg['Servers'][$i]['pdf_pages'] ...

錯誤 [ 文件 ]

建立 PDF: 已停用

 

 

$cfg['Servers'][$i]['column_info'] ...

錯誤 [ 文件 ]

顯示欄位註釋已停用

瀏覽器轉換已停用

 

 

$cfg['Servers'][$i]['bookmarktable'] ...

錯誤 [ 文件 ]

SQL 查詢書籤已停用

 

 

$cfg['Servers'][$i]['history'] ...

錯誤 [ 文件 ]

SQL 歷史已停用

 

 

$cfg['Servers'][$i]['designer_coords'] ...

錯誤 [ 文件 ]

設計器已停用

 

 

$cfg['Servers'][$i]['tracking'] ...

錯誤 [ 文件 ]

追蹤已停用

 

 

$cfg['Servers'][$i]['userconfig'] ...

錯誤 [ 文件 ]

使用者偏好已停用

 

 

快速設定進階功能:

 

  • 透過 script/create_tables.sql 建立必需的資料表 
  • 建立一個使用者並授予其訪問上一步操作中建立的資料表的權限 
  • 在設定檔案 (config.inc.php) 中啓用進階功能,參見 config.sample.inc.php 中的範例 
  • 請重新登錄 phpMyAdmin 以載入新設定並使其生效

01.解決方法:

# vim /var/www/html/phpMyAdmin/libraries/config.default.php


02.(47)


$cfg['PmaNoRelation_DisableWarning'] = true


03.接下來就重新啟動服務即解決問題!


# /etc/rc.d/init.d/httpd restar

arrow
arrow
    文章標籤
    phpmyadmin mcrypt
    全站熱搜

    天兒啊 發表在 痞客邦 留言(0) 人氣()