First, install the Xdebug
1, compile and install Xdebug, you can also use pecl install Xdebug
wget http://xdebug.org/files/xdebug-2.3.2.tgztar-zxvf xdebug-2.3.2.tgzcd xdebug-2.3.2phpize./configure- -enable-xdebug--with-php-config=/data/php/bin/php-configmake && make install
This step generates a xdebug.so file
2. Adding configuration Files
Zend_extension =xdebug.sozend_debugger.allow_hosts=127.0.0.1zend_debugger.expose_remotely=alwayszend_ Debugger.httpd_uid=-1xdebug.auto_trace = Onxdebug.auto_profile = Onxdebug.collect_params = Onxdebug.collect_return = onxdebug.profiler_enable = Onxdebug.trace_output_dir =/tmpxdebug.profiler_output_dir=/tmp/xdebugxdebug.trace_ Output_name = Trace.%c.%pxdebug.profiler_output_name=cachegrind.out.%sxdebug.dump.get = *xdebug.dump.POST = * Xdebug.dump.COOKIE = *xdebug.dump.session = *xdebug.var_display_max_data = 4056xdebug.var_display_max_depth = 5 Xdebug.remote_enable=on xdebug.remote_handler=dbgpxdebug.remote_host=127.0.0.1xdebug.remote_port= 9010xdebug.remote_autostart=1
3. Verification
Can be viewed through phpinfo
Second, the installation of Vim plug-in
1. Download
wget http://www.vim.org/scripts/download_script.php?src_id=7285 After the download is complete, the file will be unzipped into $home/.vim/plugin (mkdir ~/.vim/ Plugin) then visit, http://localhost/blog/index.php? Xdebug_session_start=1 create a new. vimrc file, join the configuration as follows: let g:debuggermaxdepth = 5let G:debuggerport = 9010 Note: To be consistent with the port configuration in Xdebug.ini.
2. Commissioning
Use VIM to open this file, with can: Bp set breakpoints, and then Ann F5 key, you will see waiting for a new connection on port 9000 for 5 seconds ..., at this time in 5 seconds refresh just that page, you can see in vim the debugging interface Surface.
If <type ' exceptions appears. Attributeerror ';, Attributeerror ("Dbgprotocol instance has no attribute ' stop ', then the description is not configured successfully,
1, xdebug.remote_* not configured well
2, either the URL is not included in the tail? Xdebug_session_start=1
3, either you did not refresh the page in 5 seconds
Precautions
In the actual process, if you find that the installation is still not working properly with PHP, it is most likely caused by the following reasons:
One,xdebug loading is not successful
Perhaps because PHP is "Debug Build", then php.ini should not use "zend_extension=/<extension_dir>/xdebug.so", but should use "zend_extension _debug=/<extension_dir>/xdebug.so ";
The other aspect is to pay attention to whether the xdebug.so path is correct, or if the Apache service or FASTCGI service is restarted.
Second, the debugging session has expired
XDebug a cookie to determine if you are debugging a conversation, please note that this cookie expires in 1 hours.
Third, SeLinux
Modify the configuration file/etc/selinux/config, change the phrase "selinux=" to "selinux=disabled", and then restart the machine.
Vim+xdebug Debugging PHP