Motomichi Works Blog

モトミチワークスブログです。その日学習したことについて書いている日記みたいなものです。

vagrantその7 phpMyAdminをインストールする

参考にさせて頂いたページ

前回に引き続き以下のページを参考にさせて頂いています。

基本的にはVirtualBox+VagrantでphpMyAdminを動かすまで - Qiitaを参考に進めてみる。

参考としてVagrantにCentOS6.5 + Apache2.2.15 + MySQL5.6.17 + PHP5.5 + phpMyAdmin4.1.13の構築方法 - Qiitaも合わせて読んでみる。

自分の中での選択

色々やった結果、私はphpMyAdminは使用しない事にした。

DBの操作はSequelProを使用する事にしたので、もし私のこのブログを見ながらvagrantで環境構築をしている方は、phpMyAdminに関する

は読まずに、

vagrantその10 コマンドでデータベースを作成する - MOTOMICHI WORKS BLOG

を読んで環境構築の続きをやると良い気がする。たぶん。

でも自分の通った道・学習の記録として、phpMyAdminに関することも削除せずに書き残しておく。

macだとSequelPro

windowsだとHeidiSQL

あたりを使ってみようかな?

MySQL用のGUI色々あるみたいです。

phpMyAdminのインストール

phpMyAdmin-4.3.3-all-languages.zip

をダウンロードして解凍し、フォルダ名をphpMyAdminにした。

phpMyAdminフォルダは、同期しているディレクトリに置いた。

ここから、web帳 | VirtualBoxとVagrantで開発環境を構築 その3 phpMyAdmin インストール centOS apache設定を参考に進めていく。

yum -y install php-mbstring php-mysql

を実行してphp-mbstring と php-mysql がインストールされた。

phpMyAdminを使用するために、httpd.confとphp.iniを編集

まずhttpd.confを編集するので

vim /etc/httpd/conf/httpd.conf

httpd.confを開く

DirectoryIndex index.html index.html.var

となっている行の代わりに

DirectoryIndex index.html index.htm index.cgi index.php

とした。

AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz

となっている行の下に

AddType application/x-httpd-php .php

と一行追加して、保存して終了。

次にphp.iniを編集するので

vim /etc/php.ini

で、php.iniを開く。

以下は引用

short_open_tag = Off
↓
short_open_tag = On ←変更(short_open_tag有効)

max_execution_time = 30
↓
max_execution_time = 300 ←変更(スクリプト実行時間)

magic_quotes_gpc = On
↓
magic_quotes_gpc = Off ←変更(エスケープ処理)

;default_charset = "iso-8859-1"
↓
default_charset = "UTF-8" ←コメント解除&変更(デフォルト文字コード)

post_max_size = 8M

post_max_size = 20M ←変更(最大POSTアップロードサイズ)

upload_max_filesize = 2M
↓
upload_max_filesize = 20M ←変更(最大アップロードサイズ)

;date.timezone =
↓
date.timezone = Asia/Tokyo ←コメント解除&変更(タイムゾーン指定)

;mbstring.language = Japanese
↓
mbstring.language = Japanese ←コメント解除(デフォルト言語)

;mbstring.internal_encoding = EUC-JP
↓
mbstring.internal_encoding = UTF-8 ←コメント解除&変更(内部文字エンコーディングのデフォルト値)

;mbstring.http_input = auto
↓
mbstring.http_input = UTF-8 ←コメント解除&変更(HTTP入力文字エンコーディング)

;mbstring.http_output = SJIS
↓
mbstring.http_output = pass ←コメント解除&変更(HTTP出力文字エンコーディング)

;mbstring.encoding_translation = Off
↓
mbstring.encoding_translation = On ←コメント解除&変更(内部文字エンコーディングの有効・無効)

;mbstring.detect_order = auto
↓
mbstring.detect_order = auto ←コメント解除(文字コード検出のデフォルト値)

;mbstring.substitute_character = none;
↓
mbstring.substitute_character = none; ←コメント解除(無効な文字を代替する文字を定義)

のように編集したら、保存して終了。

sudo service httpd restart

apacheを再起動する。

phpMyAdminのページにログインしてみる

http://192.168.33.10/phpMyAdmin/

にアクセスするとログインフォームがある。

ここまで、vagrantその1からその6まで順番にやってきた場合は

ユーザ名:root

パスワード:password

でログインできるはず。

現段階での環境

ホストマシン

ゲストマシン

データベース

webサーバ

phpMyAdmin

  • バージョン情報: 4.3.3

phpMyAdminのページ内に出ている警告

この段階でphpMyAdminは一応動くようなんだけど、なんか警告文が出ている。

  • The phpMyAdmin configuration storage is not completely configured, some extended features have been deactivated. Find out why. Or alternately go to 'Operations' tab of any database to set it up there.

  • 設定ファイルに、暗号化 (blowfish_secret) 用の非公開パスフレーズの設定を必要とするようになりました。

  • お使いになっている PHPMySQL ライブラリのバージョン 5.1.73 が MySQL サーバのバージョン 5.6.21 と異なります。これは予期しない不具合を起こす可能性があります。

  • You are using an incomplete translation, please help to make it better by contributing.

といった具合に4つ出ているのだけど、少し検索した感じでは、僕の知識でそう簡単に直せそうにない。