Vvv: XDebug could not open the remote debug file '/tmp/xdebug-remote.log'.

Created on 22 Apr 2015  路  17Comments  路  Source: Varying-Vagrant-Vagrants/VVV

I get this error on every page load after running xdebug_on. It also shows up when running any wp-cli commands.

XDebug could not open the remote debug file '/tmp/xdebug-remote.log'.

I can temporarily fix it by running:

sudo chmod 666 /tmp/xdebug-remote.log

But the next time I reload vagrant and re-enable xdebug, it's back how it was before. XDebug is working fine, it's just this annoying error message.

bug

Most helpful comment

On Ubuntu head over to the php mods folder:
cd /etc/php/7.0/mods-available

Edit the xdebug config file:
sudoedit xdebug.ini

The first line in the file should be:
xdebug.remote_log = /var/log/xdebug/xdebug.log

Edit it and tell the system to put the xdebug.log in the folder shared by your host and vm.
I'm running vmware fusion on my mac and I've set "/mnt/hgfs/" as my host/vm shared folder. I edited my xdebug.ini to have it store the xdebug.log file in a subfolder of my shared folder. Important! You need to make sure the folder exists already or create it.

xdebug.remote_log = /mnt/hgfs/html/apache_logs/xdebug.log

This solves 2 problems: 1) It will get rid of the error and 2) It will put the log file into a folder shared with your host. You can look at the log file on your host OS without having to SSH over to your VM and figure out where the file is buried in the VM OS.

All 17 comments

It seems the file needs to be world writable to avoid the error message.

Even doing this:

sudo chown www-data:www-data /tmp/xdebug-remote.log
sudo chmod 664 /tmp/xdebug-remote.log

Doesn't work, which I thought would since php5-fpm runs under www-data, and that makes it group writable...

Added a PR in case this change could be considered.

+1 @jjeaton fix worked for me

Fix works for me as well.

We should be ok to merge in #631, though I'm somewhat confused. With a fresh VM, I'm able to use xdebug_on and then load pages fine. A /tmp/xdebug-remote.log is then created with 644 permissions and a www-data owner. It would be nice to find a root cause here.

I agree. Although, I have no idea what caused this change. I've re-provisioned multiple times and had this happen on two different VVV instances. If you have any ideas, I'm open to try and debug it. When I'm not in the middle of a project I'll pull the latest VVV and reprovision again and ensure that it isn't just a version-specific issue.

While working on #691, I finally paid attention to the actual location of the log file. I wonder if we'd be better off putting it in /srv/log/ along with the php error log.

I'm still poking to try and generate the error again so that I can test. :)

@jeremyfelt I've applied the commit to my local instance and running groups says my user is in www-data.

vagrant@vvv:~$ groups
vagrant www-data
-rw-r--r-- 1 www-data www-data 35400 Sep 18 19:46 /tmp/xdebug-remote.log

I'm still having this issue from the command line though.
Running phpunit from within vagrant results in:

XDebug could not open the remote debug file '/tmp/xdebug-remote.log'.
XDebug could not open the remote debug file '/tmp/xdebug-remote.log'.
Installing...
XDebug could not open the remote debug file '/tmp/xdebug-remote.log'.
XDebug could not open the remote debug file '/tmp/xdebug-remote.log'.
XDebug could not open the remote debug file '/tmp/xdebug-remote.log'.
XDebug could not open the remote debug file '/tmp/xdebug-remote.log'.
XDebug could not open the remote debug file '/tmp/xdebug-remote.log'.
XDebug could not open the remote debug file '/tmp/xdebug-remote.log'.
Running as single site... To run multisite, use -c tests/phpunit/multisite.xml
Not running ajax tests. To execute these, use --group ajax.
Not running ms-files tests. To execute these, use --group ms-files.
Not running external-http tests. To execute these, use --group external-http.
PHPUnit 4.3.5 by Sebastian Bergmann.

Same thing w/ wp shell:

$ wp shell
XDebug could not open the remote debug file '/tmp/xdebug-remote.log'.
wp>

@jeremyfelt even with adding vagrant to the www-data group, the user still won't have write permissions to the log file, which I believe is what the issue is.

Xdebug needs to open the file for writing, but the file is only writable by the owner, which is www-data. This is why sudo chmod 664 /tmp/xdebug-remote.log seems to fix the issue. Am I missing something?

Yes, I also have to set the permissions for /srv/log/xdebug-remote.log to 664. In my case I'm running phpunit with:
`/usr/bin/php /home/vagrant/.phpstorm_helpers/phpunit.php --configuration /srv/www/site/htdocs/wp-content/plugins/plugin/phpunit.xml.dist

why was this closed?

@pdewouters it should have been fixed in https://github.com/Varying-Vagrant-Vagrants/VVV/pull/970

On Ubuntu head over to the php mods folder:
cd /etc/php/7.0/mods-available

Edit the xdebug config file:
sudoedit xdebug.ini

The first line in the file should be:
xdebug.remote_log = /var/log/xdebug/xdebug.log

Edit it and tell the system to put the xdebug.log in the folder shared by your host and vm.
I'm running vmware fusion on my mac and I've set "/mnt/hgfs/" as my host/vm shared folder. I edited my xdebug.ini to have it store the xdebug.log file in a subfolder of my shared folder. Important! You need to make sure the folder exists already or create it.

xdebug.remote_log = /mnt/hgfs/html/apache_logs/xdebug.log

This solves 2 problems: 1) It will get rid of the error and 2) It will put the log file into a folder shared with your host. You can look at the log file on your host OS without having to SSH over to your VM and figure out where the file is buried in the VM OS.

In my case chmod 666 on xdebug.log solved problem. 665 didn't worked.

Remove xdebug.log from /tmp and put it into /var/log/xdebug/xdebug.log remembering that /tmp is regularly cleared, and because of this your /tmp/xdebug.log always loss your preset. To do that, edit your /etc/php/7.2/mods-available/xdebug.ini and set the new location of xdebug.remote_log parameter to /var/log/xdebug/xdebug.log, after that reset property and permission with: $ sudo chmod 664 /var/log/xdebug/xdebug.log && sudo chown www-data:www-data /var/log/xdebug/xdebug.log && sudo systemctl restart nginx php7.2-fpm. Adapt this receipe for your environment.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings