0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

とりあえずPHPが使いたいだけなのでMac標準のApacheを起動してindex.phpファイルを開くとこまで

Last updated at Posted at 2017-10-09

とりあえず```
sudo apachectl start


止めるのは```
sudo apachectl stop
```でOK。

設定ファイルをいじらないとPHP使えない。標準で```
/private/etc/apache2/httpd.conf```
にあるので```
sudo vi /private/etc/apache2/httpd.conf```
で編集。sudoでやんないと、保存できない。

169行目あたり
```#LoadModule php5_module libevec/apache2/libphp5.so```
をとりあえずアンコメントだ!

つぎ
```237 DocumentRoot "/Library/WebServer/Documents"
 238 <Directory "/Library/WebServer/Documents">```
なんだこれ。じぶんの作業ディレクトリにしちゃえ。
```237 DocumentRoot "/Users/komaki/www"
 238 <Directory "/Users/komaki/www">```

さらに
```418 AddType application/x-compress .Z
419 AddType application/x-gzip .gz .tgz```
これに```
418 AddType application/x-compress .Z
419 AddType application/x-gzip .gz .tgz
420 AddType application/x-httpd-php .php .html```
という行を追加することで.htmlを受け取ってもApacheが起動するようになる。らしい。何の役に立つのかは不明。


参考サイト
http://motw.mods.jp/Mac/local_server.html
0
1
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?