You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Eclipse PHP Oxygen.3a版本Xdebug与内置PHP服务器兼容问题咨询

Troubleshooting Xdebug with Eclipse's Built-in PHP Server

Hey there, let's work through this Xdebug issue you're facing! It's super frustrating when Xdebug works fine with Apache but not the built-in server—luckily, the fix usually boils down to a few configuration checks. Here's what to look into:

1. Double-check your CLI PHP.ini configuration

The PHP built-in server runs in CLI mode, which uses a separate php.ini file from Apache. Even if your Apache php.ini is set up correctly, the CLI version might be missing Xdebug settings entirely.

  • First, find your CLI php.ini path by running this command in a terminal:
    php -i | grep php.ini
    
  • Open that file and make sure these Xdebug settings are present (adjust paths and ports to match your setup):
    zend_extension=xdebug.so  # On Windows, use xdebug.dll instead
    xdebug.mode=debug
    xdebug.start_with_request=yes
    xdebug.client_host=127.0.0.1
    xdebug.client_port=9003  # Note: Xdebug 3 uses 9003 by default; older versions use 9000
    xdebug.discover_client_host=0
    
  • Save the file and verify Xdebug loads in CLI by running php -v—you should see Xdebug listed in the output.

2. Verify Eclipse's Debug Configuration

Eclipse might not be pointing to the right debugger settings for the built-in server:

  • Go to Run > Debug Configurations
  • Select your PHP Web Page configuration (or create a new one)
  • Under the Server tab, confirm the server is set to PHP Built-in Web Server
  • Switch to the Debugger tab:
    • Ensure the debugger is set to Xdebug
    • Match the Port value to what you set in php.ini (9003 or 9000)
    • Check Break at first line to test if the debugger triggers immediately

3. Confirm Xdebug is active in the built-in server

Run your phpinfo script via the built-in server, then search the page for "Xdebug". If you don't see any Xdebug-related sections, that means the CLI php.ini changes didn't take effect:

  • Double-check the zend_extension path is correct (it should point directly to your Xdebug binary)
  • Restart Eclipse and stop/start the built-in server to apply config changes

4. Check for port conflicts or firewall blocks

Xdebug needs to communicate with Eclipse over the configured port, so make sure nothing is blocking that:

  • Use these commands to check if the port is in use:
    • Windows: netstat -ano | findstr :9003
    • Linux/macOS: lsof -i :9003
  • If another program is using the port, either kill that process or change Xdebug's client_port to an unused number (update both php.ini and Eclipse's debug config)
  • Ensure your local firewall allows incoming connections on that port for Eclipse

5. Test with a manual built-in server launch

If all else fails, try starting the built-in server manually with Xdebug flags to rule out Eclipse's launch configuration:

php -dxdebug.mode=debug -dxdebug.start_with_request=yes -S localhost:8000

Then in Eclipse, set up a debug configuration to connect to localhost:8000 and see if breakpoints trigger.

Hopefully one of these steps gets Xdebug working with the built-in server! Let me know if you hit any snags along the way.

内容的提问来源于stack exchange,提问作者Peter Schaeffer

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 07:45:21