OS X 10.9 Mavericks上的PHP Xdebug?

内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用

  • 回答 (2)
  • 关注 (0)
  • 查看 (19)

在OSX上设置PHP开发环境时遇到问题

sudo pecl install xdebug

downloading xdebug-2.2.3.tgz ...
Starting to download xdebug-2.2.3.tgz (250,543 bytes)
.....................................................done: 250,543 bytes
66 source files, building
running: phpize
grep: /usr/include/php/main/php.h: No such file or directory
grep: /usr/include/php/Zend/zend_modules.h: No such file or directory
grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory
Configuring for:
PHP Api Version:
Zend Module Api No:
Zend Extension Api No:
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

ERROR: `phpize' failed

有人有解决办法或解决办法吗?

提问于
用户回答回答于

快速复制粘贴方式

sudo sh -c 'echo zend_extension=$(find /usr/lib/php/extensions -name "xdebug.so") >> $(php -qr "echo php_ini_loaded_file();") && apachectl restart'

此命令执行以下操作:

  • 查找随xcode附带的本机xdeb扩展。
  • 询问php加载了哪个配置文件。
  • 在配置文件中添加xdeb扩展路径。
  • 重启apache.

用户回答回答于

有两个简单的选择:

  1. 使用已在以下网站上提供的版本:
  2. 建立你自己的:
1. Make sure you have the Xcode CLI tools: `xcode-select --install` will prompt you to install the CLI tools. With the CLI tools installed, there should be stuff inside `/usr/include/php`.
2. Go to [http://xdebug.org/download.php](http://xdebug.org/download.php) and download the source tarball for the version of Xdebug you want. For example: [http://xdebug.org/files/xdebug-2.2.3.tgz](http://xdebug.org/files/xdebug-2.2.3.tgz). 
3. Extract the tarball and `cd` into the directory it created. Inside that directory you'll see a `README`. From here it's:$phizeConfiguration for:PHPApi版本:20100412 ZendModuleApi No:20100525 ZendExtensionApi No.220100525$./Configuration--对处理长行的grep启用-x调试检查和-e.../usr/bin/grep检查egrep.../usr/bin/grep-E检查不截断输出的sed.../usr/bin/sed......输出...$Make...输出...

用你的xdebug.so在上面的(1)或(2)中,可以将这个块添加到php.ini被你的phpphp-fpm:

[Xdebug]
zend_extension=<full_path_to_xdebug.so>
xdebug.remote_enable=1
xdebug.remote_host=<host running PHP (e.g. localhost)>
xdebug.remote_port=<port Xdebug tries to connect to on the host running PHP (default 9000)>

扫码关注云+社区