win下php7.0 + nginx + xdebug2.4调试
1 win下安装php7.0与nginx
来源PHP-TS中的start_wnmp文件,双击则启动php7.0、nginx、mysql服务。
2 安装xdebug
访问http://xdebug.org/download.php页面,按照php版本(php的位数、php的编译环境、php的线程安全与否等)下载对应的xdebug的链接库。此处应下载php_xdebug-2.4.0rc3-7.0-vc14-x86_64.dll文件。将下载好的文件移入PHP-TS\ext文件夹下。
修改php.ini文件配置,加载xdebug插件。以下以php.ini代码:
[xdebug]
zend_extension = D:\PHP-TS\ext\php_xdebug-2.4.0rc3-7.0-vc14-x86_64.dll
xdebug.remote_enable=true
xdebug.collect_params=3
;xdebug.collect_return=1
xdebug.collect_vars=1
xdebug.collect_assignments=1
xdebug.collect_includes=1
xdebug.trace_format=0
xdebug.auto_trace=0
;xdebug.trace_options=1
;xdebug.profiler_enable = off
;xdebug.profiler_enable_trigger = off
;xdebug.profiler_output_name =cachegrind.out.%t.%p
xdebug.trace_output_name=trace.%H%R%t
;xdebug.show_local_vars=1
xdebug.remote_handler = dbgp
xdebug.remote_host= localhost
xdebug.remote_port = 9999
xdebug.cli_color=2
xdebug.show_exception_trace=0
xdebug.show_mem_delta=1
xdebug.var_display_max_children=-1
xdebug.var_display_max_data=-1
xdebug.var_display_max_depth=6
需要指明的是xdebug的端口号改为9999,也没有指定idekey。
最后需要检查xdebug安装是否成功,如果在phpinfo()页面中显示xdebug项,则安装成功,截图如下:
3 在sublime或者phpstrom中配置xdebug
3.1 在sublime中配置xdebug
首先sublime2或者sublime3需要安装package manager,项目地址为https://packagecontrol.io/。
接下来安装xdebug插件,使用ctrl+shift+p 呼出package manager,查找xdebug并安装。如果此步没有对话框弹出的话,请翻墙。
配置xdebug的参数如下:
然后打开文件夹,插入xdebug断点,使用ctrl+shift+p呼出package manager输入xdebug,出现如下图所示:
点击Xdebug:Start Debuffing(Launch Browser),开始调试。
参考资料:
sublime配置xdebug:http://blog.csdn.net/rongyongfeikai2/article/details/19853093
3.2 phpstrom 配置xdebug
首先配置phpstrom的xdebug端口为9999,配置phpstrom的PHP Web Application,如下图:
配置完成之后,插入断点,点击调试按钮开始调试,调试按钮位置如下图:
参考资料:
phpstrom配置xdebug:http://blog.csdn.net/dc_726/article/details/9905517
3.3 Atom配置xdebug
打开Atom编辑器,使用Atom打开一个配置好Webserver的文件夹,依次点击File、Settings、Install按钮,进入如下界面:
在输入框中输入php_debug点击Packages搜索按钮开始搜索插件,在出现的列表中找到php_debug,点击该项的Install按钮,等待安装。
安装成功之后,点击Packages,如下:
在以下页面配置xdebug选项,如下图:
配置好xdebug选项之后,进入代码页面,在左侧的行号中右击,依次点击PHP_DEBUG、Toggle BreakPoint,如下图:
在页面任意一处右击,在弹出的菜单中依次选择PHP_DEBUG、Toggle Debugging,开始监听9000端口,使用浏览器访问http://127.0.0.1在Atom中发现如下图所示:
4 附录
nginx.conf配置:
#user nobody;
worker_processes 1;
error_log logs/error.log;
error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name b2b.dev;
set $root_path 'E:/GITFILE/B2B/src/website/public';
root $root_path;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
try_files $uri $uri/ @rewrite;
location @rewrite {
rewrite ^/(.*)$ /index.php?_url=/$1;
}
location ~ \.php {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index /index.php;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
root $root_path;
}
location ~ /\.ht {
deny all;
}
}
}
win下php7.0 + nginx + xdebug2.4调试
1 win下安装php7.0与nginx
来源PHP-TS中的start_wnmp文件,双击则启动php7.0、nginx、mysql服务。
2 安装xdebug
访问http://xdebug.org/download.php页面,按照php版本(php的位数、php的编译环境、php的线程安全与否等)下载对应的xdebug的链接库。此处应下载php_xdebug-2.4.0rc3-7.0-vc14-x86_64.dll文件。将下载好的文件移入PHP-TS\ext文件夹下。
修改php.ini文件配置,加载xdebug插件。以下以php.ini代码:
[xdebug]
zend_extension = D:\PHP-TS\ext\php_xdebug-2.4.0rc3-7.0-vc14-x86_64.dll
xdebug.remote_enable=true
xdebug.collect_params=3
;xdebug.collect_return=1
xdebug.collect_vars=1
xdebug.collect_assignments=1
xdebug.collect_includes=1
xdebug.trace_format=0
xdebug.auto_trace=0
;xdebug.trace_options=1
;xdebug.profiler_enable = off
;xdebug.profiler_enable_trigger = off
;xdebug.profiler_output_name =cachegrind.out.%t.%p
xdebug.trace_output_name=trace.%H%R%t
;xdebug.show_local_vars=1
xdebug.remote_handler = dbgp
xdebug.remote_host= localhost
xdebug.remote_port = 9999
xdebug.cli_color=2
xdebug.show_exception_trace=0
xdebug.show_mem_delta=1
xdebug.var_display_max_children=-1
xdebug.var_display_max_data=-1
xdebug.var_display_max_depth=6
需要指明的是xdebug的端口号改为9999,也没有指定idekey。
最后需要检查xdebug安装是否成功,如果在phpinfo()页面中显示xdebug项,则安装成功,截图如下:
3 在sublime或者phpstrom中配置xdebug
3.1 在sublime中配置xdebug
首先sublime2或者sublime3需要安装package manager,项目地址为https://packagecontrol.io/。
接下来安装xdebug插件,使用ctrl+shift+p 呼出package manager,查找xdebug并安装。如果此步没有对话框弹出的话,请翻墙。
配置xdebug的参数如下:
然后打开文件夹,插入xdebug断点,使用ctrl+shift+p呼出package manager输入xdebug,出现如下图所示:
点击Xdebug:Start Debuffing(Launch Browser),开始调试。
参考资料:
sublime配置xdebug:http://blog.csdn.net/rongyongfeikai2/article/details/19853093
3.2 phpstrom 配置xdebug
首先配置phpstrom的xdebug端口为9999,配置phpstrom的PHP Web Application,如下图:
配置完成之后,插入断点,点击调试按钮开始调试,调试按钮位置如下图:
参考资料:
phpstrom配置xdebug:http://blog.csdn.net/dc_726/article/details/9905517
3.3 Atom配置xdebug
打开Atom编辑器,使用Atom打开一个配置好Webserver的文件夹,依次点击File、Settings、Install按钮,进入如下界面:
在输入框中输入php_debug点击Packages搜索按钮开始搜索插件,在出现的列表中找到php_debug,点击该项的Install按钮,等待安装。
安装成功之后,点击Packages,如下:
在以下页面配置xdebug选项,如下图:
配置好xdebug选项之后,进入代码页面,在左侧的行号中右击,依次点击PHP_DEBUG、Toggle BreakPoint,如下图:
在页面任意一处右击,在弹出的菜单中依次选择PHP_DEBUG、Toggle Debugging,开始监听9000端口,使用浏览器访问http://127.0.0.1在Atom中发现如下图所示:
4 附录
nginx.conf配置:
#user nobody;
worker_processes 1;
error_log logs/error.log;
error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name b2b.dev;
set $root_path 'E:/GITFILE/B2B/src/website/public';
root $root_path;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
try_files $uri $uri/ @rewrite;
location @rewrite {
rewrite ^/(.*)$ /index.php?_url=/$1;
}
location ~ \.php {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index /index.php;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
root $root_path;
}
location ~ /\.ht {
deny all;
}
}
}