Thursday, September 11, 2014

How to install Xdebug for your php version

Why do I need this?


Xdebug's basic functions include the display of stack traces on error conditions, maximum nesting level protection and time tracking. If you like Xdebug, consider giving them a "donation".

Prerequirements


In order to install Xdebug you need to have installed php. If you don't know how I recommend you to install WampServer, you can find the instructions here.

Where to download?


You can download it from the official site. Based on your machine you will download the 32-bit or 64-bit of your php version (don't download the TS version unless you know what you doing), in my example I needed xdebug for php 5.6.0 and I have 32-bit machine so I will download the PHP 5.6 VC11 (32 bit). If you not sure which one is for you go to this link and copy paste there your phpinfo output. If you are using WampServer you can find the phpinfo by going to this url http://localhost/?phpinfo=1 or open cmd and write:

php -i

after clicking Analyse my phpinfo() output you will see the download link on the first step of instructions.


How to install it?


Go to your php ext directory in my example is C:\wamp\bin\php\php5.6.0\ext and extract your dll file there. Now open your php.ini file, my is located here C:\wamp\bin\php\php5.6.0 and at the end of the file add

; XDEBUG Extension

zend_extension = "c:/wamp/bin/php/php5.6.0/ext/php_xdebug-2.2.5-5.6-vc11.dll"
#The bellow settings were setted by WampServer
[xdebug]
xdebug.remote_enable = off
xdebug.profiler_enable = off
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "c:/wamp/tmp"
xdebug.show_local_vars = 0

If you using WampServer then add the above code also to phpForApache.ini. To finish the installation on WampServer, click on the WampServer tray icon and then Restart All Services.

Verify that it works


When you will go to the http://localhost/?phpinfo=1 scroll down until you will see this message

or in your cmd write

php -i

and you will see somewhere

xdebug

xdebug support => enabled
Version => 2.2.5

No comments:

Post a Comment