本人php 剛剛入門,最近看了一位大神的blog,以爲是時候擯棄windows 開發環境了.因而 在本身電腦上搭建了一個ubuntu16.04 系統php
因爲習慣了windows上PHP+xdebug 的調試,在用了幾天的var_dump 後深深以爲不適應,決定在ubuntu上裝一個xdebug. html
本文是在小生搭建的時候寫的,其中會引用到百度上的搭建方法.若有引用 請多包含.chrome
首先是要下載 xdebug 擴展 ubuntu
sudo apt-get install php-xdebug
安裝好了後 php -v 若是出現以下 表示已經安裝好了windows
如下是引用 http://www.cnblogs.com/yangqi7/p/6555555.html 這位大哥寫的bash
我裝的php是php7.0 用的是apt 安裝的 擴展目錄是在 /etc/php/7.0/ php7
該目錄下有兩個 一個是cli 另一個是fpm phpstorm
擴展是放在 mods_availabel下php-fpm
編輯改目錄下的插入如下代碼debug
zend_extension = xdebug.so xdebug.profiler_enable = 1 xdebug.profiler_output_dir = "/tmp" xdebug.remote_enable = 1 xdebug.remote_port=9000 xdebug.remote_host = "mds-parts-tst.dev.***"
其中 xdebug.remote_host 是本地的一個域名
接下來 就是配置 phpstorm
若是這裏沒有顯示你的php的版本信息 點擊 ... 而後就出現以下界面
若是這裏已經出現了 php的版本 和xdebug 的版本說明已經安裝成功了
此時 你必須 重啓 php-fpm 才能生效
而後 若是你用的 是chrome 到擴展裏面去下一個 xdebug 而後就能夠 愉快的調試了
f7 進入程序 f8 下一步 f9 調到下一個斷點