12

I've got xdebug installed fine (showing up in phpinfo()) but I'm trying to get it to work with PHPUnit's code coverage functionality. It keeps telling me "The XDebug extension is not loaded". I've got phpunit working fine with WAMP. When i run php -m i don't see xdebug listed in neither php modules nor zend modules which points as to why phpunit is not find the xdebug extension

Does anyone have any idea of this problem?

My detailed configuration is as follows: Windows 7 php 5.3.0 Apache 2.2.11 Zend Engine v2.3.0 Xdebug v2.1.0

Thanks, Krishnen

krishnen
  • 172
  • 1
  • 1
  • 9

6 Answers6

7

perform php --ini to check witch config file is loaded.
if you have something like this :

Loaded Configuration File: (none)
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)

Just copy your php.ini in windows directory ;)

Androideur
  • 159
  • 2
  • 2
  • 1
    When the user is loading a web page (which means that he uses apache) the module version of php is being used and that version's settings are showed by phpinfo() function.Php --ini command from the command line shows settings for the stand-alone cgi version of php. – skiabox Nov 23 '12 at 19:09
4

Does WAMP have a different config file for the CLI and Apache? I use Ubuntu personally, but a quick google got me to this WAMP FAQ

HTH.

Robin
  • 4,096
  • 15
  • 20
  • Hi, phpinfo indicates that the following ini file is loaded C:\wamp\bin\apache\Apache2.2.11\bin\php.ini...that's the one i modified added the following settings : [XDebug] zend_extension="C:\wamp\bin\php\php5.3.0\ext\php_xdebug.dll" xdebug.remote_enable = 1 – krishnen Sep 29 '10 at 15:17
  • 1
    That path, i.e. `C:\wamp\bin\apache\Apache2.2.11\bin\php.ini` seems to indicate that you've only altered the APACHE PHP config file, not the CLI PHP config file. See edorian's answer for a pointer on how to find out which config file your CLI PHP is using. – Robin Sep 29 '10 at 17:10
  • you are right! am such an idiot..i added the zend_extension setting in the other CLI PHP config file and it now works on windows as well.Thks – krishnen Sep 29 '10 at 18:57
  • 2
    That FAQ has since disappeared. – Ian Hunter Dec 14 '11 at 16:54
2

Type php --ini on cmd and go to the php.ini file shown.

This php.ini need to have XDEbug configuration...

Mine is:

    
[XDebug]
; Only Zend OR (!) XDebug
zend_extension=C:\wamp\bin\php\php5.3.0\ext\php_xdebug-2.0.5-5.3-vc6.dll
; XAMPP and XAMPP Lite 1.7.0 and later come with a bundled xdebug at /php/ext/php_xdebug.dll, without a version number.
xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
; Port number must match debugger port number in NetBeans IDE Tools > Options > PHP
xdebug.remote_handler=dbgp
xdebug.profiler_enable=1
xdebug.profiler_output_dir="c:\wamp\xdebug"
xdebug.var_display_max_depth = 10
xdebug.var_display_max_data = 2048

(please consider the breaking lines)

Ricardo Martins
  • 4,793
  • 1
  • 33
  • 50
1
  1. open php.ini.
  2. look for ;zend_extension
  3. remove ; at the beginning of ;zend_extension to enable it
  4. Be sure value of zend_extension is the right directory for the php_xdebug.dll
JM R.
  • 1,311
  • 1
  • 8
  • 4
1

Thanks to all who answered. I repeated the procedure on a ubuntu workstation.This time i compiled everything from source.Everything worked to perfection and am now able to run the phpunit with coverage. This must be a windows specific issue.I'll just use a linux box for this process. Anyone having issues to setup xdebug on linux, i'll be glad to help!

krishnen
  • 172
  • 1
  • 1
  • 9
0

You need to create two symlinks:

  1. c:\php is a symlink to your current php folder
  2. c:\windows\php.ini is a symlink to your current php.ini file

To create a symlink in windows use mklink command

e.g.

  • mklink /D c:\php c:\path\to\your\php folder makes a symlink to directory
  • mklink c:\windows\php.ini c:\path\to\your\php\php.ini makes a symlink to file

It seems in windows somehow phpunit doesnt see actual paths and with that symlinks you create virtual default paths for it

Kimvais
  • 34,273
  • 14
  • 100
  • 135