问题
I'm getting the following error when trying to use xhprof in PHP 5.4
PHP Warning: PHP Startup: xhprof: Unable to initialize module
Module compiled with module API=20090626
PHP compiled with module API=20100525
It looks like I have some conflict with PHP versions as I installed 5.4 some days ago. php-v shows 5.4 but php-config --version shows 5.3 and phpize shows API=20090626 while PHP is compiled with API=20100525
回答1:
sudo apt-get install php5-dev
In my case the solution was to upgrade the package php5-dev. It looks like when I upgraded php to 5.4 didn't upgrade the php5-dev one, that's why php-config and phpize were outdated. So problem solved.
回答2:
Correct, you do need to install php5-dev.
This is mentioned in my complete guide to installing XHProf, available here http://www.insprinto.com.au/display/turbocharge-your-php-with-xhprof?id=4
来源:https://stackoverflow.com/questions/22630762/cant-install-xhprof-in-php-5-4