我在开发环境中遇到了Xdebug问题。Xdebug在访问类静态属性时中断
FROM library/php:5.5-apache
RUN apt-get -qqy update && apt-get -qqy install \
libpq-dev \
libmcrypt-dev \
libxml2-dev \
ssl-cert \
vim \
git \
mc \
&& rm -r /var/lib/apt/lists/*
# compile and add xdebug
RUN pecl install xdebug \
&& echo "zend_extension=xdebug.so" >> "/usr/local/etc/php/conf.d/xdebug.ini"
# configure apache and vhosts
RUN a2enmod rewrite ssl \
&& a2ensite 000-default default-ssl
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2
ENV APACHE_RUN_DIR /var/run/apache2
ENV APACHE_PID_FILE /var/run/apache2/apache2.pid
ENV APACHE_LOCK_DIR /var/lock/apache2
CMD ["apache2-foreground"]
Xdebug的设置:
[xdebug]
xdebug.remote_enable=1
xdebug.remote_autostart=0
xdebug.remote_host=172.17.42.1
xdebug.remote_port=9000
一切工作不错,但一两件事。当调试代码:
<?php
class A {
static private $a;
static public function init() {
self::$a = 123;
}
}
A::init();
如果我设置一个断点上self::$a = 123;
或步入行,我得到:
Fatal error: Access to undeclared static property: A::$a
如果我不踏入这行,调试会话继续无任何问题。
怎么了?
与Xdebug v2.3.2 PHP 5.4.43相同的问题。 通过docker自己构建。 – shark555
我使用了不同的xdebug版本,不同的调试客户端。我已经通过pecl安装了xdebug并自己编译。问题必须在官方码头里的某个地方php image –
你在用什么IDE? – bishop