Intellij IDEA de PHP
PHPのことは、ずっと毛嫌いしていたんですが、
何かに導かれて、『はじめてのPHP5』を買ってしまいました。
一生の不覚です。
- 作者:David Sklar
- 発売日: 2012/09/24
- メディア: 大型本
早速、サンプルをコーディングするべく、PHPの環境をつくります。
brewでPHPをインストール
$ brew tap homebrew/dupes $ brew tap josegonzalez/homebrew-php $ brew install php54
とかした記憶があります。詳しくは、こちらを参考に。
[ HomebrewでPHP環境 現時点でのまとめ - なんたらノート第三期ベータ]
xdebugインストール
$ brew install php54-xdebug
/usr/local/etc/php/5.4/conf.d/ext-xdebug.iniに以下を追加します。
[xdebug] zend_extension="/usr/local/Cellar/php54-xdebug/2.2.1/xdebug.so" xdebug.profiler_append = 0 xdebug.profiler_enable = 1 xdebug.profiler_enable_trigger = 0 xdebug.profiler_output_dir = "/tmp" xdebug.profiler_output_name = "cachegrind.out.%t-%s" xdebug.remote_enable = 1 xdebug.remote_handler = "dbgp" xdebug.remote_host = "127.0.0.1" xdebug.trace_output_dir = "/tmp"
Web Moduleを選択してプロジェクトを作成
Run/Debug構成の設定
Run>Edit Configurations...
PHP Built-in Web Server追加
apacheは面倒なので、PHP内蔵のBuilt-in Web Serverを使ってます。
ところで、Macの場合、なぜか、80番ポートは、sudo権限ないと、サーバー起動時に、permission deniedになるので、別の8080番とかに設定しておこう。(これにはハマった。)
PHP Web Application追加
Run/Debugを実行
まず、Built-in Web ServerをRunで実行します。
その上で、Debugしたい場合は、PHP Web ApplicationをDebugで実行します。
テスト的にphpinfo()のphpファイルをブラウザで開ければOK。
追記
configure: error: freetype.h not found.
brew install php54で、上記のエラーが発生!!
https://github.com/josegonzalez/homebrew-phpに記載されてるとおり、freetypeを入れなおして対処しました。
brew rm freetype jpeg libpng gd zlib brew install freetype jpeg libpng gd zlib