PhpStorm + Xdebugでリモートデスクトップ
Xdebug?
1. Xdebugをインストール(CentOS)
php-devel、php-pearをインストール
$ yum install php-devel
$ yum install php-pear
gcc、gcc-c++、autoconf、automakeをインストール
$ yum install gcc gcc-c++ autoconf automake
Xdebugをインストール
$ pecl install Xdebug
// ※エラーになる場合
// yum --enablerepo=remi-phpバージョン install php-devel php-pear
$ yum --enablerepo=remi-php56 install php-devel php-pear
/etc/php.iniを修正
$ vi /etc/php.ini
↓以下を追加
[xdebug]
zend_extension="/usr/lib64/php/modules/xdebug.so"
xdebug.default_enable = 1
xdebug.remote_enable = 1
xdebug.remote_port = 9000
xdebug.remote_handler = dbgp
xdebug.remote_autostart = 1
xdebug.profiler_output_dir = "/tmp"
xdebug.max_nesting_level = 1000
xdebug.idekey = "PHPSTORM" //PhpSTORMで設定したideKey
xdebug.remote_host=xxx.xxx.xxx.xxx
Apacheをリスタート
$ service httpd restart
2. PhpStormでの設定
リモートホストの設定
1.Remote Hostを表示
[ Tools > Deployment > Browse Remote Host ]をクリックする
2. サーバーを登録
[ Tools > Deployment > Configuration... ] を開く
[test SFTP connection]
をクリックし、成功することを確認
PHPリモートデバッグの設定
[ Run > Edit Configurations... ] を開く
これでPhpStorm + Xdebugでリモートデスクトップ環境構築完了!