我一直在尝试使Xdebug与可在Nginx上的php8.0-fpm上运行的Laravel一起使用而失败。
我正在使用PhpStorm触发断点,但似乎甚至xdebug_break()
没有触发。
这些是我拥有的所有配置,phpinfo()
如果需要,我也可以在评论中发布:
nginx:
server {
listen 80;
server_name dashboard.local;
root /var/www/dashboard/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
的PHP配置:
PHP 8.0.0 (cli) (built: Nov 27 2020 12:26:22) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.0-dev, Copyright (c) Zend Technologies
with Zend OPcache v8.0.0, Copyright (c), by Zend Technologies
with Xdebug v3.0.0, Copyright (c) 2002-2020, by Derick Rethans
➜ ~ php-config -v
Usage: /usr/bin/php-config [OPTION]
Options:
--prefix [/usr]
--includes [-I/usr/include/php/20200930 -I/usr/include/php/20200930/main -I/usr/include/php/20200930/TSRM -I/usr/include/php/20200930/Zend -I/usr/include/php/20200930/ext -I/usr/include/php/20200930/ext/date/lib ]
--ldflags [-L/usr/lib/php/20200930 ]
--libs [-lcrypt -largon2 -lresolv -lcrypt -lutil -lrt -lm -ldl -lxml2 -lssl -lcrypto -lpcre2-8 -lz -lsodium -largon2 -lcrypt ]
--extension-dir [/usr/lib/php/20200930]
--include-dir [/usr/include/php/20200930]
--man-dir [/usr/share/man]
--php-binary [/usr/bin/php8.0]
--php-sapis [cli fpm ]
--phpapi [20200930]
--ini-path [/etc/php/8.0/cli]
--ini-dir [/etc/php/8.0/cli/conf.d]
--configure-options [--includedir=/usr/include --mandir=/usr/share/man --infodir=/usr/share/info --disable-silent-rules --libdir=/usr/lib/x86_64-linux-gnu --libexecdir=/usr/lib/x86_64-linux-gnu --disable-maintainer-mode --disable-dependency-tracking --prefix=/usr --enable-cli --disable-cgi --disable-phpdbg --with-config-file-path=/etc/php/8.0/cli --with-config-file-scan-dir=/etc/php/8.0/cli/conf.d --build=x86_64-linux-gnu --host=x86_64-linux-gnu --config-cache --cache-file=/build/php8.0-xu5Vr1/php8.0-8.0.0/config.cache --libdir=${prefix}/lib/php --libexecdir=${prefix}/lib/php --datadir=${prefix}/share/php/8.0 --program-suffix=8.0 --sysconfdir=/etc --localstatedir=/var --mandir=/usr/share/man --disable-all --disable-debug --disable-rpath --disable-static --with-pic --with-layout=GNU --without-pear --enable-filter --with-openssl --with-password-argon2=/usr --with-external-pcre --enable-hash --with-mhash=/usr --with-libxml --enable-session --with-sodium --with-system-tzdata --with-zlib=/usr --with-zlib-dir=/usr --enable-dtrace --enable-pcntl --with-libedit=shared,/usr build_alias=x86_64-linux-gnu host_alias=x86_64-linux-gnu CFLAGS=-g -O2 -fdebug-prefix-map=/build/php8.0-xu5Vr1/php8.0-8.0.0=. -fstack-protector-strong -Wformat -Werror=format-security -O2 -Wall -pedantic -fsigned-char -fno-strict-aliasing -g]
--version [8.0.0]
--vernum [80000]
xdebug.ini(/etc/php/8.0/mods-available/xdebug.ini):
zend_extension = /usr/lib/php/20200930/xdebug.so
; zend_extension = xdebug.so
xdebug.remote_enable = 1
xdebug.remote_mode = req
xdebug.remote_host = http//dashboard.local
xdebug.remote_port = 9009
xdebug.remoce_connect_back = on
xdebug.remote_handler = "dbgp"
xdebug.remote_autostart = 0
xdebug.idekey = PHPSTORM
xdebug.remote_autostart = 0
xdebug.remote_log = "/var/log/xdebug/xdebug.log"
xdebug.show_error_trace = 1
xdebug.start_with_request = yes
PhpStorm:
谢谢 :)
编辑1:
我已经降级到php 7.4和Xdebug 2.9.8,但看来我仍然无法从Xdebug得到任何响应。根据LazyOne的要求,这是我的所有配置。
的PHP配置:
Usage: /usr/bin/php-config [OPTION]
Options:
--prefix [/usr]
--includes [-I/usr/include/php/20190902 -I/usr/include/php/20190902/main -I/usr/include/php/20190902/TSRM -I/usr/include/php/20190902/Zend -I/usr/include/php/20190902/ext -I/usr/include/php/20190902/ext/date/lib ]
--ldflags [-L/usr/lib/php/20190902 ]
--libs [-lcrypt -largon2 -lresolv -lcrypt -lrt -lm -ldl -lxml2 -lssl -lcrypto -lpcre2-8 -lz -lsodium -lcrypt -largon2 -lcrypt ]
--extension-dir [/usr/lib/php/20190902]
--include-dir [/usr/include/php/20190902]
--man-dir [/usr/share/man]
--php-binary [/usr/bin/php7.4]
--php-sapis [apache2handler cgi cli fpm ]
--phpapi [20190902]
--ini-path [/etc/php/7.4/cli]
--ini-dir [/etc/php/7.4/cli/conf.d]
--configure-options [--includedir=/usr/include --mandir=/usr/share/man --infodir=/usr/share/info --disable-silent-rules --libdir=/usr/lib/x86_64-linux-gnu --libexecdir=/usr/lib/x86_64-linux-gnu --disable-maintainer-mode --disable-dependency-tracking --prefix=/usr --enable-cli --disable-cgi --disable-phpdbg --with-config-file-path=/etc/php/7.4/cli --with-config-file-scan-dir=/etc/php/7.4/cli/conf.d --build=x86_64-linux-gnu --host=x86_64-linux-gnu --config-cache --cache-file=/build/php7.4-efh2kh/php7.4-7.4.13/config.cache --libdir=${prefix}/lib/php --libexecdir=${prefix}/lib/php --datadir=${prefix}/share/php/7.4 --program-suffix=7.4 --sysconfdir=/etc --localstatedir=/var --mandir=/usr/share/man --disable-all --disable-debug --disable-rpath --disable-static --with-pic --with-layout=GNU --without-pear --enable-filter --with-openssl --with-password-argon2=/usr --with-external-pcre --enable-hash --with-mhash=/usr --with-libxml --enable-session --with-sodium --with-system-tzdata --with-zlib=/usr --with-zlib-dir=/usr --enable-dtrace --enable-pcntl --with-libedit=shared,/usr build_alias=x86_64-linux-gnu host_alias=x86_64-linux-gnu CFLAGS=-g -O2 -fdebug-prefix-map=/build/php7.4-efh2kh/php7.4-7.4.13=. -fstack-protector-strong -Wformat -Werror=format-security -O2 -Wall -pedantic -fsigned-char -fno-strict-aliasing -g]
--version [7.4.13]
--vernum [70413]
phpinfo()的xdebug部分:
xdebug日志:
空的
PHPStorm配置:
在与LazyOne进行会话之后,我们发现我没有使用正确的Xdebug模式,因为我需要将其设置为debug
。以前,我将其设置为develop
意味着开发辅助,并认为它也包含步骤调试器。
这是最终配置的外观(对于Xdebug 3.0.1):
zend_extension=xdebug.so
xdebug.mode=develop,debug
xdebug.client_port=9009
xdebug.client_host=127.0.0.1
然后,这使我能够触发断点,前提是我在chrome中具有Xdebug Helper扩展名,或者在发出请求时提供了XDEBUG_SESSION_START参数(在我的情况下,= PHPSTORM)。
再次感谢你的帮助,LazyOne!