1. 程式人生 > 實用技巧 >xdebug 遠端除錯

xdebug 遠端除錯

----------------------------------------------------

下面的連結下載對應版本的xdebug.

https://xdebug.org/download/historical

原始碼安裝:https://xdebug.org/docs/install#linux

Installation From Source

Obtain

You candownloadthe source of the lateststablerelease 3.0.2.

Alternatively you can obtain Xdebug from GIT:

git clone git://github.com/xdebug/xdebug.git

This will checkout the latest development version which is currently 3.1.0-dev. This development branch might not always work as expected, and may have bugs.

You can also browse the source on GitHub athttps://github.com/xdebug/xdebug.

Compile

There is awizardavailable that provides you with the correct file to download, and which paths to use.

You compile Xdebug separately from the rest of PHP. You need access to the scriptsphpizeandphp-config. If your system does not havephpizeandphp-config, you will need to install the PHP development headers.

Debian users can do that with:

apt-get install php-dev

And RedHat and Fedora users with:

yum install php-devel

It is important that the source version matches the installed version as there are slight, but important, differences between PHP versions. Once you have access tophpizeandphp-config, take the following steps:

  1. Unpack the tarball:

    tar -xzf xdebug-3.0.2.tgz

    You shouldnotunpack the tarball inside the PHP source code tree. Xdebug is compiled separately, all by itself, as stated above.

  2. cd xdebug-3.0.2

  3. phpize (這一步,用對應版本的phpize , 如:/opt/PHP-5.6/bin/phpize)

    If phpize is not in your path, please make sure that it is by expanding thePATHenvironment variable. Make sure you use the phpize that belongs to the PHP version that you want to use Xdebug with. Seethis FAQ entryif you're having some issues with finding which phpize to use.

  4. ./configure --enable-xdebug

  5. make

  6. make install

Configure PHP

  1. Add the following line tophp.ini:

    zend_extension=/wherever/you/put/it/xdebug

  

zend_extension = /opt/PHP-5.6/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so

xdebug.remote_enable=1

xdebug.remote_autostart = 1 ;這個配置是比較重要的一個配置

xdebug.remote_port=9013
xdebug.remote_log="/xdebug-log"

xdebug.remote_host="192.168.123.41" ;遠端除錯的ip地址,即你自己的本機ip

 

  

————————————————————————————————————————