Tag Archives

2 Articles

環境構築

PHPStrom

JetBrains社のPHPStormで行います。

https://www.jetbrains.com/phpstorm/

からダウンロードしてインストールしてください。

LAMP環境

LAMP環境を構築しておく

Ubuntuであれば下記のコマンドでインストールできる

インストール時では/var/www以下がデフォルトのサーバールートになってしまうのでユーザーフォルダ以下の適当なディレクトリを許可する

DocumentRootをユーザーフォルダ/localhostとする

localhost/にindex.phpを生成

localhostにアクセスしてhelloと表示されればOK

Composer

composerはphpのパッケージ管理プログラムです。

 

how to debug php application on Ubuntu using phpstorm

php application can debug locally

ex. stop at breakpoint

INSTALL PHPSTORM

php storm is nice IDE for php debug.

you can access and download in jetbrains website (students are free).

install and launch php storm.

INSTALL LAMPSERVER

if you are not installed LAMP environment and using Ubuntu, you can install it by following command.

INSTALL XDEBUG

php debug need xdebug utility

SETUP YOUR PHP PROJECT

launch php storm and create or open your php project.

click [File]>[Settings] on menu bar.

select [Languages & Frameworks]>[PHP]>[Servers] on left pane.

click [+] and input “localhost” and port number that your server listens.

select “Xdebug” at Debugger.

click [OK] button.

click [Run]>[Edit Configurations] on menu bar.

click [+] button and select “PHP Remote Debug”

select your server on “servers” that you created at previous section.

ide key is anything ok

click [ok] button.

click [Run]>[Start Listening for php debug connections] on menu bar.

ACCESS AND DEBUG YOUR CODE

setup are completed above.

click [Run]>[Debug].

access “localhost” using your browser.

program are stopped at breakpoint position 🙂