如何使用调试,TS 编译 PHP 5.3.6 的 php 扩展


How to compile php extension for PHP 5.3.6 with debug, TS

我试图创建一些php扩展。

第一次我用--enable-debug --enable-maintainer-zts编译了php 5.3.6.然后我放弃了我的扩展并为其使用标准程序

phpize
./configure --with-EXTNAME
make

然后将extname.so复制到我的 php 扩展目录,并更改php.ini

当我尝试从 cli 使用 php 时,我遇到了一个错误

Unable to initialize module
Module compiled with build ID=API20090626,NTS
PHP    compiled with build ID=API20090626,TS,debug

当我尝试时

./configure --enable-debug --enable-maintainer-zts

对于扩展,我收到警告说配置脚本无法识别这些选项。

那么,如何在不重新编译 php 本身的情况下编译我的扩展以与使用我上面描述的选项编译的 PHP 一起使用呢?

你需要./configure --with-php-config=/path/to/correct/php-config .

配置脚本可能使用另一个php-config(可能是集中安装的

(。

在我的服务器中有 2 个 phpize

  /usr/bin/php/phpize
  /usr/bin/php-zts/phpize

以确保它使用线程安全编译,而不是使用"phpize"做

/usr/bin/php-zts/phpize
./configure --with-php-config=/usr/bin/php-zts/php-config
make
make install