xdebug, eclipse, centos, remote debugging - unable

2019-06-08 12:24发布

问题:

dev machine

  • mac laptop, 10.8.3
  • eclipse, Juno SR2
  • php pdt 3.1.2.2012

remote machine

  • parallels, vm, CentOS 6.3
  • php 5.4.14
  • xdebug

/etc/php.ini file

[xdebug]
zend_extension=/usr/lib64/php/modules/xdebug.so
xdebug.remote_enable=1
xdebug.remote_handler="dbgp"
xdebug.remote_mode=req
xdebug.remote_port=9000
xdebug.remote_host="10.211.55.3"
xdebug.remote_log=/tmp/xdebug_remote_log
xdebug.remote_connect_back=1

The PHP files all live on the remote machine and are mapped into a project in eclipse (i.e. i can see the actual files on my dev machine).

I have a debug configuration and can run in the debugger, but can't set or stop at any breakpoint. I even tried xdebug_break() - just seems to ignore it.

I tried opening port 9000 on the remote machine, no difference.

I tried adding this '-Djava.net.preferIPv4Stack=true' to the eclipse.ini file (found in another post -- had to do with IPv6 vs. IPv4), didn't work.

Project properties in eclipse:

  • PHP Debugger: XDebug
  • Server:
    • Base URL: h_t_t_p_://10.211.55.3
    • Path Mapping: Path on server: /home/userxyz/workspace/test, Local Path: /test

I am out of ideas about what to try. Any help would be greatly appreciated.

回答1:

I show you Remote server on a windows machine used there filezilla. My Ubuntu 12.04 is at the moment not on.

Try to make a connection to your FTP-server.

Be shure ftp is up and running. Set your ftp server that you can connect from your local machine.

Change your perspective to Remote System explorer.
Remote System explorer view
Create a new connection

Test your ftp connection

Ftp Server settings.

  • 1 For each user to have ftp access, to create a system user.

  • 2 If not present the line

/bin/false

Add to /etc/shells.

  • 3 In/etc/passwd file for each FTP user as a login shell /bin/false rejected.

    for example:

userxy: x: 1003:1002:/home/userxy:/bin/false

Eclipse Ftp setting

Final steps.

only when a connection to ftp server is established.

  • On your server create a folder in /var/www/html call the folder switch-r .

  • Create a new PHP Project call it Switch-Remote .

right click at Switch-Remote select new folder.

after OK your project looks

right click on the new folder switch select new PHPFile .

after OK you can see following in eclipse ftp log .

and your project ..

open switch.php and replace with new code.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Cp1252">
<title>Remote Debug</title>
</head>
 <?php
    echo "Hello<br>";
    echo "from DTX-AGIL-3";
    ?>
</html>

put a breakpoint at line 8 .

Create a new Debug Configuration

Change the settings as seen in the next image .

Debug with the just created config .
Debug stops at line 8.

and finish.

Everything you change or you rename files,
everything is automatically transferred via FTP to the server.



回答2:

I have a similar configuration here and I am using samba to share the server folder. When I open the project on Eclipse I am using the file the server uses to process the requests. the correct file map is still necessary to break points working as expected.

So, I have a Ubuntu box with the following settings:

Machine Name : ubuntu-12-10
Document Root : /www/sites/project1
Smb share : [www] -> /www

Eclipse Mac OS:
workspace : /Volumes/ubuntu-12-10/www/sites
site : http://ubuntu
project : project1
maps :

  • Path on server : /www/sites/project1
  • Local Path : /project1

Adapting for your world you should to be able to stop on breakpoints.