I am trying to get Xdebug code coverage analysis for PHP working on the command line, but I get an undefined function error for code coverage functions. I am not using PHPUnit, and I'm not using an IDE. My text editor is Komodo Edit.
I am using:
- Windows 8
- PHP 5.4.12
- Apache 2.2.4 (but command-line PHP)
- WAMP
I downloaded Xdebug 2.2.4 for PHP 5.4 VC9 TS (64 bit) and followed the instructions on the Xdebug install page to configure my computer.
I changed the php.ini files in C:\wamp\bin\apache\Apache2.4.4\bin and C:\wamp\bin\php\php5.4.12 to have the following settings for xdebug:
zend_extension = c:\wamp\bin\php\php5.4.12\ext\php_xdebug-2.2.4-5.4-vc9-x86_64.dll
[xdebug]
xdebug.remote_autostart=on
xdebug.remote_enable = on
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"
xdebug.idekey=xdebug
xdebug.remote_log="c:/wamp/tmp/xdebug/xdebug_remote.log"
xdebug.coverage_enable = on
I added XDEBUG_CONFIG="idekey=xdebug" to my environment variables. I then restarted WAMP.
When I try to call xdebug_code_coverage_started() from my script, I get
PHP Fatal error: Call to undefined function xdebug_code_coverage_started()
The same happens for any code coverage functions I try. However, var_dump(xdebug_get_headers()) works. My phpinfo shows xdebug.coverage_enable is on.
I have also tried:
- not setting xdebug.coverage_enable (it defaults to on)
- not setting XDEBUG_CONFIG
- setting xdebug.remote_enable to off
- not setting xdebug.idekey, xdebug.remote_log, and xdebug.remote_autostart
all with the same results.
How do I get PHP to recognize Xdebug code coverage functions?
c:\wamp\bin\php\php5.4.12\ext\php_xdebug-2.2.4-5.4-vc9-x86_64.dlllike"c:\wamp\bin\php\php5.4.12\ext\php_xdebug-2.2.4-5.4-vc9-x86_64.dll"- dyachenko