I'm using XAMPP on Mac OS, trying to use PHPUnit's code coverage checks, which require XDebug. The xdebug.so file comes with XAMPP so I've enabled Xdebug for PHP:
// /Applications/XAMPP/xamppfiles/etc/php.ini
[xdebug]
zend_extension="/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so"
xdebug.remote_enable=1
Now, when I check from the web server, there is an Xdebug section inside the output from phpinfo()
.
But when I'm trying to check code coverage I get an error:
$ phpunit --coverage-html report
PHPUnit 3.7.31 by Sebastian Bergmann.
The Xdebug extension is not loaded. No code coverage will be generated.
I think CLI using different php.ini
than Apache . To find which php.ini
file CLI is using I did this:
$ php -i | grep "php.ini"
Configuration File (php.ini) Path => /etc
But there is no /etc/php.ini
so I copied one over:
$ sudo cp /Applications/XAMPP/xamppfiles/etc/php.ini /etc/php.ini
Now I'm checking php -m
for modules, but there is no Xdebug and I'm getting this error:
$ php -m
Failed loading /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so: dlopen(/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so, 9): Symbol not found: _zend_execute_ex
Referenced from: /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so
Expected in: flat namespace
in /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so
[PHP Modules]
bcmath
bz2
...
Here is the content of my php.ini
file (check last lines.)
Can you tell me how I can enable Xdebug for PHPUnit and CLI ?
What which php
output you have?
Looks like you're using system-wide php instead of XAMPP version. To use XAMPP add PATH=/Applications/XAMPP/xamppfiles/bin/:PATH
to your ~/.bashrc
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With