1
2

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.

vagrant-centos6-php & Netbeans でデバッグできるようになるまで

Posted at

vagrant-centos6-php & Netbeans でデバッグできるようになるまで

なりゆき

趣味で PHP をいじりたく、フレームワークを探していた。 FuelPHP が軽快らしくためしてみることに。 ローカルで作業するので vagrant で動かす。
ネットでしらべたところよさそうなプロジェクトを見つけた。
vagrant-centos6-php
これで最初のページを表示し Netbeans でデバッグできるようになるまで幾つか躓くことがあった。

最初の関門

※ここは記憶が曖昧で内容が正しくない可能性あり。 確認しようと一度 box を destroy して作りなおしてみたら最初のページは何もせずに表示されたため再現できなかった
Vagrantfile で fuelphp を選択して up し、取説の「プロジェクトへのアクセス方法」にならってアクセスすると "No composer autoloader found. Please run composer to install the FuelPHP framework dependencies first!" というメッセージが出てきた。 これはインストールの際に Composer が GitHub API を用いており、GitHub API は時間あたりのアクセス数を制限しており、制限に引っかかるとこのメッセージが表示される。 ここはググると出てくる他のサイトに書いてあるように GitHub の自分のアカウントの設定ページからトークンを作成してインストールでトークンを求められた時に貼り付ければ OK。

デバッグの準備

このページにならって設定したが Netbeans でデバッグを実行すると「接続を待っています」という状態でブレークポイントにも引っかからずうまくいかなかった。 xdebug はインストール済みだったので「php.iniの設定」のみ行った。
Vagrantで起動したPHP環境をNetBeansからリモートデバッグする方法

色々試した結果、以下の設定でうまくデバッグ出来るようになった。 デバッグ状態でデバッグしたいページを開くと、そのページにブレークポイントが設定されていればそこで止まる。

zend_extension="/usr/lib64/php-zts/modules/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_connect_back=1
xdebug.remote_autostart=on
xdebug.idekey="netbeans-xdebug"

プロジェクトツリーのファイルを右クリックで出るメニューからの、ファイルを指定してのデバッグは fuel/app/classes/controller がパスに挟まるせいか機能しなかった。

あと、色々試している際、apache を再起動する際にいちいち

Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName

とうるさいので /etc/httpd/conf/httpd.conf に ServerName localhost.localdomain:80 という記述を追加しといた。

1
2
0

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
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?