不用print調試 xdebug ubuntu phpstorm 遠程斷點調試

 

即便這會寫php也遵照zebra大人的指示:不用print調試!!!!----環境ok  ---gan !!!php

 

 

 

wweb

 

 

http://blog.csdn.net/ty_hf/article/details/50768702 apache

https://ubuntuforums.org/showthread.php?t=525257ubuntu

https://yq.aliyun.com/ziliao/164576vim

https://php-built.com/2016/01/20/installing-xdebug-for-php7/服務器

 

 

 

 

php -vphp7

sudo apt-get install php-dev php-pearapp

sudo pecl install xdebugphpstorm

 

Build complete.
Don't forget to run 'make test'.ide

running: make INSTALL_ROOT="/tmp/pear/temp/pear-build-rootuh4LBI/install-xdebug-2.5.4" install
Installing shared extensions:     /tmp/pear/temp/pear-build-rootuh4LBI/install-xdebug-2.5.4/usr/lib/php/20151012/

  +----------------------------------------------------------------------+
  |                                                                      |
  |   INSTALLATION INSTRUCTIONS                                          |
  |   =========================                                          |
  |                                                                      |
  |   See http://xdebug.org/install.php#configure-php for instructions   |
  |   on how to enable Xdebug for PHP.                                   |
  |                                                                      |
  |   Documentation is available online as well:                         |
  |   - A list of all settings:  http://xdebug.org/docs-settings.php     |
  |   - A list of all functions: http://xdebug.org/docs-functions.php    |
  |   - Profiling instructions:  http://xdebug.org/docs-profiling2.php   |
  |   - Remote debugging:        http://xdebug.org/docs-debugger.php     |
  |                                                                      |
  |                                                                      |
  |   NOTE: Please disregard the message                                 |
  |       You should add "extension=xdebug.so" to php.ini                |
  |   that is emitted by the PECL installer. This does not work for      |
  |   Xdebug.                                                            |
  |                                                                      |
  +----------------------------------------------------------------------+


running: find "/tmp/pear/temp/pear-build-rootuh4LBI/install-xdebug-2.5.4" | xargs ls -dils
395602    4 drwxr-xr-x 3 root root    4096 Jun 13 20:14 /tmp/pear/temp/pear-build-rootuh4LBI/install-xdebug-2.5.4
395676    4 drwxr-xr-x 3 root root    4096 Jun 13 20:14 /tmp/pear/temp/pear-build-rootuh4LBI/install-xdebug-2.5.4/usr
395677    4 drwxr-xr-x 3 root root    4096 Jun 13 20:14 /tmp/pear/temp/pear-build-rootuh4LBI/install-xdebug-2.5.4/usr/lib
395678    4 drwxr-xr-x 3 root root    4096 Jun 13 20:14 /tmp/pear/temp/pear-build-rootuh4LBI/install-xdebug-2.5.4/usr/lib/php
395679    4 drwxr-xr-x 2 root root    4096 Jun 13 20:14 /tmp/pear/temp/pear-build-rootuh4LBI/install-xdebug-2.5.4/usr/lib/php/20151012
395675 1444 -rwxr-xr-x 1 root root 1477312 Jun 13 20:14 /tmp/pear/temp/pear-build-rootuh4LBI/install-xdebug-2.5.4/usr/lib/php/20151012/xdebug.so

Build process completed successfully
Installing '/usr/lib/php/20151012/xdebug.so'
install ok: channel://pecl.php.net/xdebug-2.5.4
configuration option "php_ini" is not set to php.ini location
You should add "zend_extension=/usr/lib/php/20151012/xdebug.so" to php.ini
scipy@ubuntu:/$


scipy@ubuntu:/$ sudo find -name php.ini
./etc/php/7.0/cli/php.ini
./etc/php/7.0/apache2/php.ini


scipy@ubuntu:/$ vim  ./etc/php/7.0/apache2/php.ini
scipy@ubuntu:/$ sudo vim  ./etc/php/7.0/apache2/php.ini
scipy@ubuntu:/$ sudo vim ./etc/php/7.0/cli/php.ini

 

sudo /etc/init.d/apache2 restart


gg:命令將光標移動到文檔開頭

G:命令將光標移動到文檔末尾

 

 


scipy@ubuntu:/var$ sudo chown scipy:scipy www -R
 

xdebug.default_enable = On
xdebug.collect_params = On
; 若是開啓此,將忽略下面的 xdebug.remote_host 的參數。 <一臺webserver有多個開發者的工做目錄的時候使用,如:p1.xx.com,p2.xx.com,p3.xx.com 。。。等。 >
xdebug.remote_connect_back = Off
; 客戶端的ip<即IDE的機器的ip,不是你的web server>
xdebug.remote_host = 192.168.95.252
; 客戶端的端口<即IDE的機器的ip,不是你的web server>
xdebug.remote_port = 9900
xdebug.remote_enable = On
xdebug.remote_handler = dbgp
xdebug.remote_log = /var/www/data_well_xdebug/xdebug.log
xdebug.remote_req = req
xdebug.auto_trace = Off
xdebug.remote_autostart = On
xdebug.show_exception_trace = 0
xdebug.collect_vars = On
xdebug.collect_return = On
xdebug.collect_params = On
xdebug.var_display_max_depth = 15
xdebug.show_local_vars = 1
xdebug.dump_undefined = 1
xdebug.profiler_enable = 1
xdebug.profiler_output_dir = /var/www/data_well_xdebug

 

xdebug.idekey = phpstorm_data_well_tmp_php

 

PHPSTORM 配置:
1.file->setings->php|Debug右側。xdebug的那一塊。
設置Debug port:9900(這裏設置 的是,xdebug 吐出的debug信息,經過本機的什麼端口傳輸。)

DBGp IdeKey  phpstorm_data_well_tmp_php
2.file->setings->php|Servers  右側。 
host: 你的web服務器的域名或ip ,端口,  下面的 use path mapping  意的是,你的項目的目錄,對應服務器上的,什麼目錄?  
這裏必定要設置哦! 否則,會發生找不到文件而出錯,導至調試終止。
3.Run->Edit Configurations-> 增長一個 PHP WEB APPlication 的調試點。 
右側: server 選擇你上面創建的server.  starturl 設置你的入口文件。
至此,配置完畢!

 

 

相關文章
相關標籤/搜索