LoginSignup
24
26

More than 5 years have passed since last update.

PhpStorm(on Windows10) 基本設定メモ(1) - php+xdebug環境

Last updated at Posted at 2016-08-22

$cos^2x$番煎じのメモ
php+xdebug環境をローカルに構築(php同梱Webサーバ利用)
(※2016/08/22時点)

software version
PhpStorm v2016.02
php 5.6.25
xdebug 2.4.1

PHP install

PHP windowsバイナリ

  • VC11 x64 Thread Safe (2016-Aug-18 22:03:13)
  • php-5.6.25-Win32-VC11-x64

zipファイルの中身を例えば下記へ設置

C:\php56_25

xdebug install

xdebug windowsバイナリ

  • xdebug 2.4.1 > PHP5.6 VC11 TS(64bit)
  • php_xdebug-2.4.1-5.6-vc11-x86_64

phpインストール先のext以下に設置

C:\php56_25\ext

php.ini設定

php.ini設置

phpインストールディレクトリ直下にある php.ini-development を php.ini にリネーム

timezone設定

date.timezone = Asia/Tokyo

xdebug設定

profiler_output_dir には適当なディレクトリを設定

[xdebug]
zend_extension="C:\php56_25\ext\php_xdebug-2.4.1-5.6-vc11-x86_64.dll"
xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.profiler_enable=1
xdebug.profiler_output_dir=<OUTPUT_DIR>
xdebug.idekey="PHPSTORM"

PhpStorm Setting

ツールバーの File > Setting

PHPインタプリタ設定

Languages & Frameworks > PHP

interpreter: の横の ... をクリックしてphpインストールパスを追加
InterpreterにインストールしたPHPバージョンが表示されていることを確認

PHPリモートサーバ追加

Languages & Frameworks > PHP > Servers

+をクリックしてサーバを追加

Name: localhost
Host: localhost
Port: 80
Debugger: xdebug

xdebug設定確認

Languages & Frameworks > PHP > Debug

xdebugポートがphp.iniと同じことを確認

ブラウザでのデバッグ用設定

ブックマークレットかエクステンション(アドオン)を用意

ブックマークレット登録

phpstormブックマークレット

  • IDE keyを"PHPSTORM"にしてGenerate
  • Start debugger/stop debuggerをブックマーク登録

エクステンションインストール

chromeの場合

xdebug helper

  • 拡張設定からidekeyを"PHPSTORM"に設定

実行

Run Config

ツールバーのRun->Edit Configuration
左上の+をクリック

(1) PHP Built-in Web Serverを選択

(お好みで)

Name: Local Built-in
Document root: <DOCUMENT_ROOT>

(2) PHP Remote Debugを選択

Name: Local Xdebug
Servers: localhost
ide key: PHPSTORM

Runしてみる

Local Built-in web serverを指定してRun

Debugしてみる

Local Xdebugを指定して、右上の電話機のようなアイコンをクリック
ブレークポイントを指定しておいてブラウザで開き、
startdebuggerのブックマークレットをクリック、
またはxdebug helperのアイコンをクリックしてdebugを指定

ブラウザを更新

24
26
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
24
26