Skip to content

Instantly share code, notes, and snippets.

@gaspanik
Created September 30, 2012 14:49
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gaspanik/3806983 to your computer and use it in GitHub Desktop.
Save gaspanik/3806983 to your computer and use it in GitHub Desktop.
Install: Install phpMyAdmin on 10.8.x

Installing phpMyAdmin by Homebrew

HomebrewでphpMyAdminを入れる方法

※OS Xの中のApacheとPHPを動かして、MySQLをHomebrewで入れてる前提

それがまだなら、まずは以下を

Apache+PHP+MySQL(Homebrew) on Mountain Lion https://gist.github.com/3806975

HomebrewでPHPのあれこれを追加できるように

お決まりの一発

brew tap homebrew/dupes

※OS Xの中のライブラリを使うとエラーになったりするようなので、上のを使うのがいいみたい

HomebrewのPHP関連のリポジトリを追加

brew tap josegonzalez/homebrew-php

で、インストール

brew install phpmyadmin

依存するもの(mcrypt)はついでにインストールされる

--

Note that this formula will NOT install mysql. It is not required since you might want to get connected to a remote database server.

Webserver configuration example (add this at the end of your /etc/apache2/httpd.conf for instance) :

Alias /phpmyadmin /usr/local/share/phpmyadmin
<Directory /usr/local/share/phpmyadmin/>
   Options Indexes FollowSymLinks MultiViews
   AllowOverride All
   Order allow,deny
   Allow from all
</Directory>

Then, open http://localhost/phpmyadmin

More documentation : file:///usr/local/Cellar/phpmyadmin/3.4.10.1/share/phpmyadmin/Documentation.html ==> Summary /usr/local/Cellar/phpmyadmin/3.4.10.1: 783 files, 17M, built in 14 seconds

--

Apacheのバーチャルホストに上記のエイリアスなんかを追加しておく

※PHP5.4系のもあって、brew doctorを実行するとImportしてないよエラーがでるので気にしないか、とりあえず入れちゃったらいいか的に外しておくなら以下のコマンドを

brew untap josegonzalez/homebrew-php

php.ini の書き換え

mcryptがないとか言われるので、それを有効に。

sudo vi /etc/php.ini

モジュールをロードするように

enable_dl = On

で、「Dynamic Extensions」に以下を追加

extension=/usr/local/Cellar/php53-mcrypt/5.3.13/mcrypt.so

一旦、Apacheを再起動

sudo apachectl restart

phpmyadmin の設定

設定ファイルをまずはコピーする。ディレクトリを移動して

cd /usr/local/Cellar/phpmyadmin/3.4.10.1/share/phpmyadmin/

「config.sample.inc.php」を「config.inc.php」にコピー

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

で、最低限必要な箇所を書き換える

$cfg['blowfish_secret'] = '任意の文字列適当に'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

認証をクッキーに

/* Authentication type */

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

localhostだと蹴られるので、「127.0.0.1」に書き換える

/* Server parameters */

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

あと、下の2個をとりあえずコメントアウト(// を取り除く)

/* Storage database and tables */

$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';

(中略)

$cfg['Servers'][$i]['userconfig'] = 'pma_userconfig';

ここまでできたらログインしてみる

http://localhost/phpmyadmin

テーブルのインポート

phpmyadminにログインできたら、「インポート」のところから「create_tables.sql」を追加する

open /usr/local/Cellar/phpmyadmin/3.4.10.1/share/phpmyadmin/scripts/

ターミナルからコマンドを実行するとこのディレクトリが開く

そこにある「create_tables.sql」をドラッグしてインポート

一度ログアウトして、再度ログインしてみよう

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment