【Mountain Lion】アップデートで動かなくなったApache開発環境を再びセットアップする。

OSのアップデートで動かなくなったApache開発環境(PHP,Mysql,バーチャルホスト込)の再セットアップの手順としては、ApacheのConf編集→PHPの有効化→Vhostの有効化→Mysqlインストール→dumpしたsqlを読み込み。とほぼ初期設定からやりなおさなきゃいけなかったので、GUIベースで生きてる僕にはしんどい。でしたので、行き詰まった所を抑えながらセットアップの要点だけ話します。

0.ソフトウェアのインストールを妨げるGateKeeperのセキュリティ設定を緩和する。

→環境設定を開きセキュリティとプライバシーへ、一般タブの中にある”ダウンロードしたアプリケーションの実行許可”を、「すべてのアプリケーションを許可」に変更する。まずこれをおこなっていないと、MacAppStore外のソフトウェア(例えばMysql)などインストール出来ないので注意。

1.OSの環境設定からWEB共有設定がなくなっているので、下記の方法でApacheを起動する。

僕が踏んだ手順は2通りあります。

ⅰ.Web Sharing.prefPane (GUIベースのトグルスイッチ)

→参考: この記事 の上部の方に記述されている、Web Sharing toggle switch in System Preferences ファイルをダウンロードして、インストール。するとOSの環境設定内に、GUIベースの管理パネルが生まれます。これはこれで幸せ。

ⅱ.ターミナルと対話
→アプリケーションからターミナルを開いて、黒い窓でコマンドを打ち込みます。

Apacheの再起動

$ sudo apachectl restart

これでブラウザにlocalhostと打ち込めば 「It Works!」が表示されるはず…とおもいきや僕の環境では表示されなくて、困りました。
2.ユーザーのWebルートフォルダを変更する。

ログを調べた所、どうやらWebRootフォルダが昔で言うところのユーザーのホームディレクトリにあったSitesフォルダを参照してたはずなのに、Mountain Lionからパスが変わっていて合ってなかったみたいです。たぶん。

→「ユーザー名.conf」ファイルを作り、参照先を正す。

移動

$ cd /etc/apache2/users

Vimでファイルを作成 (Vimの使い方はぐぐってください)

$ sudo vim username.conf

※注意!  username.conf のusername部分は、あなたのユーザー名を入れてください。ちなみに僕は前の環境の名残が残っていて、guest.confしかなかったので今回新たにconfファイルを作成しました。

■ username.conf の中身に下のソースを入れて、保存。

<Directory "/Users/username/Sites/">
Options Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>

こちらも、Directoryのusername部分はあなたのユーザー名を入れて下さい。

最後に、

アクセス権限を755に変更してApache再起動

$ sudo chmod 755 username.conf
$ sudo apachectl restart

—————–

この時点で http://localhost/~username/ にアクセスしてみれば、先ほどusername.confに書いた

"/Users/username/Sites/" の中のindex.htmlが見えるはずです。

3.あとはいつも通りに、Phpの有効化・バーチャルホストの設定・Mysqlインストール

→参考: Mac OS X Snow LeopardにWEBの開発環境を整える

この記事のバーチャルホストの設定のところから入ると、あとはスッと環境が整ってくれます。バーチャルホストの設定も、以前の設定を持ってきてもなんら問題ありませんでした。手順0と2を抜かしてしまうとアプリケーションのインストールだったり、WebRootの参照先が悪かったりとで時間を食うことになる気がします!

という感じで今に至るわけですが、phpの動くapacheとmysqlは立ち上がっているんですけど、データベースがphpつながってなくて、アレ…?!  片岡大先生になんとかしていただかなくては。

DBに強くなりたい。

← Previous post

Next post →

61 Comments

  1. pretty post nice say to unniversey mey thank

  2. Wow, awesome blog layout! How long have you been blogging for? you made blogging look easy. The overall look of your site is fantastic, let alone the content! Download Anime http://www.youtube.com/watch?v=lL20HU3uTwY

  3. 【Mountain Lion】アップデートで動かなくなったApache開発環境を再びセットアップする。 | Behind the Design. oakley sunglasses outlet http://www.discountsunglassesshopoutlet.com/

  4. Possibly You Also Make All these Slip-ups With bag ?

  5. I just procured this unique rift powerleveling the actual exceptional.

  6. Q4IGuk Thanks for sharing, this is a fantastic post.Really looking forward to read more. Keep writing.

  7. Major thanks for the blog. Great.

  8. c0FKHe Thanks-a-mundo for the article post.Really thank you! Really Great.

  9. Thanks for the article. Keep writing.

  10. We appreciate, result in I ran across what exactly I had been seeking. You could have wrapped up my own Some evening extended quest! Our god Bless you man. Use a fantastic time. Ok bye

  11. What as up, I log on to your blogs on a regular basis. Your humoristic style is awesome, keep up the good work!

  12. Wow, superb blog layout! How long have you been blogging for? you made blogging look easy. The overall look of your site is wonderful, let alone the content!

  13. Great article post.Really thank you! Fantastic.

  14. Very good blog post. Much obliged.

  15. A round of applause for your blog article.Thanks Again. Great.

  16. pris issue a ce, lettre sans meme monde me

  17. Wow, great article post.Really looking forward to read more.

  18. that it can easily likewise remedy additional eye mark complications to ensure you can certainly get one

  19. Muchos Gracias for your blog article.Really looking forward to read more. Awesome.

  20. Appreciate you sharing, great post.Really thank you! Really Great.

  21. Im obliged for the post.Really looking forward to read more. Awesome.

  22. Wow, amazing blog layout! How long have you been blogging for? you make blogging look easy. The overall look of your web site is magnificent, let alone the content!

  23. This is very interesting, You are a very skilled blogger. I have joined your rss feed and look forward to seeking more of your great post. Also, I ave shared your web site in my social networks!

  24. I simply could not depart your web site prior to suggesting that I extremely enjoyed the standard info a person provide on your guests? Is going to be again often in order to check out new posts

  25. Some truly prize articles on this website , saved to fav.

  26. that, this is magnificent blog. An excellent read.

  27. Appreciate you sharing, great blog post.Thanks Again. Fantastic.

  28. This is such a great resource that you are providing and you give it away for free.

  29. I loved your article post.Much thanks again. Awesome.

  30. Very good article post.Really thank you! Keep writing.

  31. Im grateful for the article post.Thanks Again. Awesome.

  32. Very informative blog post.Thanks Again. Cool.

  33. Appreciate you sharing, great article post.Thanks Again. Really Great.

  34. Looking forward to reading more. Great article post.Really looking forward to read more. Want more.

  35. I just want to tell you that I am all new to blogging and truly savored your web page. Likely I’m planning to bookmark your website . You really come with impressive article content. Thanks a lot for sharing your blog.

  36. Really appreciate you sharing this blog post. Fantastic.

  37. Enjoyed every bit of your post. Cool.

  38. I value the article post.Really thank you! Much obliged.

  39. I think this is a real great article.Thanks Again. Will read on…

  40. Major thanks for the blog article. Keep writing.

  41. Really enjoyed this article post.Really thank you! Fantastic.

  42. It is advisable to focus on company once you may. It is best to bring up your company to market this.

  43. This is really interesting, You are a very skilled blogger. I ave joined your feed and look forward to seeking more of your great post. Also, I have shared your site in my social networks!

  44. Very good post.Much thanks again. Want more.

  45. Thank you for your blog article. Will read on…

  46. That is a good tip particularly to those fresh to the blogosphere. Brief but very precise info Appreciate your sharing this one. A must read post!

  47. I value the article post.Thanks Again. Will read on…

  48. Usually I do not read post on blogs, but I wish to say that this write-up very pressured me to try and do it! Your writing style has been amazed me. Thank you, very great post.

  49. It as not that I want to copy your web site, but I really like the pattern. Could you tell me which style are you using? Or was it especially designed?

  50. Very neat blog post.Really looking forward to read more. Want more.

  51. Really appreciate you sharing this post.Really thank you! Will read on…

  52. Fantastic blog article.Thanks Again. Cool.

  53. I really like and appreciate your blog article.Really thank you! Really Great.

  54. Muchos Gracias for your blog post.Thanks Again.

  55. I cannot thank you enough for the blog article.Thanks Again. Keep writing.

  56. I was suggested this website by my cousin. I am not sure whether this post is written by him as no one else know such detailed about my problem. You are wonderful! Thanks!

  57. Thank for the article. Worth reading

  58. YhnXIz You, my pal, ROCK! I found exactly the info I already searched everywhere and simply could not locate it. What an ideal web site.

  59. Thank you ever so for you article post. Fantastic.

  60. Thanks for this amaing article.

  61. Thanks for the article.

1 Pingback

  1. URL

コメントを残す