xdebug, eclipse, centos, remote debugging - unable

2019-06-08 12:46发布

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.

2条回答
虎瘦雄心在
2楼-- · 2019-06-08 13:13

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.

查看更多
做自己的国王
3楼-- · 2019-06-08 13:20

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

enter image description here

enter image description here

Test your ftp connection

enter image description here

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

enter image description here

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 .

enter image description here

right click at Switch-Remote select new folder.

enter image description here

after OK your project looks

enter image description here

right click on the new folder switch select new PHPFile .

enter image description here

after OK you can see following in eclipse ftp log .

enter image description here

and your project ..

enter image description here

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 .

enter image description here

Create a new Debug Configuration

enter image description here

Change the settings as seen in the next image .

enter image description here

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

enter image description here

and finish.

enter image description here

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

查看更多
登录 后发表回答