PHP xdebug配置和php及nginx网站启用方式

1)通过不同的php版本下载不同版本的xdbug,如php版本为php-5.4.15-Win32-VC9-x86,可参考下载php_xdebug-2.2.1-5.4-vc9.dll,放置在php/ext目录下.
注:不同的xdebug有分nts版本和无nts版本.
2)在php.ini文件末尾添加
;onload Xdebug
;注意:zend_extension_nts ="F:/php/ext/php_xdebug-2.2.2-5.4-vc9-nts.dll"
zend_extension="F:/php/ext/php_xdebug-2.2.1-5.4-vc9.dll"
 
;xdebug configuration
[Xdebug]
 
xdebug.auto_trace = On
 
xdebug.show_exception_trace = On
 
xdebug.remote_autostart = On
 
xdebug.remote_enable = On
 
xdebug.collect_vars = On
 
xdebug.collect_return = On
 
xdebug.collect_params = On
3)在eclipse->window->Preferences针对xdebug调试进行Debug\PHP Executables\PHP Servers选项进行配置,默认xdebug调试端口为9000
4)网站启用配置采用Nginx和php配合,使用方法如下:
F:\nginx-1.5.0\nginx.exe;
f:/php/php-cgi.exe -b 127.0.0.1:9999 -c f:/php/php.ini
二者后台运行,同时配置nginx/conf中的nginx.conf文件,如下:
worker_processes 1;
error_log  f:/nubia/www/logs/nginx_error.log  error;
pid        f:/nubia/www/logs/nginx.pid;
#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 1024;
events
{
  worker_connections 64;
}
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;
    
    tcp_nodelay     on;
    sendfile        on;
    tcp_nopush     on;
    
    server_tokens off;     #关闭版本显示
    keepalive_timeout  60;
    #设定请求缓冲
    server_names_hash_bucket_size 128;
    client_header_buffer_size    16k;
    large_client_header_buffers  4 64k;
    client_max_body_size 8m;
    
    proxy_connect_timeout   300;
    proxy_send_timeout      300;
    proxy_read_timeout      300;
    proxy_buffer_size       128k;
    proxy_buffers           4 256k;
    proxy_busy_buffers_size 256k;
    proxy_temp_file_write_size 64m; 
    proxy_ignore_client_abort on;
    
    open_file_cache max=204800 inactive=20s;
    open_file_cache_min_uses 1;
    open_file_cache_valid 30s;
  
    #开启gzip模块
    gzip on;
    gzip_min_length  1k;
    gzip_http_version 1.1;
    gzip_buffers     4 16k;
    gzip_comp_level 2; #0-9 默认值为1,值越大压缩率越高,消耗的cpu资源越多,传输量减小
    gzip_types       text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
    gzip_vary on;
    
    #gzip_static on;
    gzip_proxied        any;
    gzip_disable    "MSIE [1-6]\.";
    
    output_buffers   1 32k;
    postpone_output  1460; 
server {
listen          80;
include        rewrite_nubia.conf;
access_log   off;
location / {
index  index.html index.htm index.php;
root   F:/nubia/www/zte_bbs;
expires      30d;
}
location ~ \.php$ {
fastcgi_pass   127.0.0.1:9999;
fastcgi_index  index.php;
fastcgi_param  SCRIPT_FILENAME  F:/nubia/www/zte_bbs$fastcgi_script_name;
include        fastcgi_params;
}
}
server {
listen          8180;
access_log   off;
location / {
index  index.html index.htm index.php;
root   F:/Discuz_X2.5_SC_UTF8/upload;
expires      30d;
}
location ~ \.php$ {
fastcgi_pass   127.0.0.1:9000;
fastcgi_index  index.php;
fastcgi_param  SCRIPT_FILENAME  F:/Discuz_X2.5_SC_UTF8/upload$fastcgi_script_name;
include        fastcgi_params;
}
}
 
}
nginx支持多server启用,通过访问不同端口启用不同网站
5)在使用php和nginx即可通过网址访问后台,但在加入xdebug后发现网址无法访问,nginx 504 gateway Timeout(网关超时),后通过nginx.conf中的error_log路径查看错误log,发现在使用php-cgi.exe端口配置为9000,与上述xdebug默认端口冲突,重新修改下php-cgi端口即可.
posted @ 2013-06-05 16:04  wang_tale  阅读(789)  评论(0编辑  收藏  举报