缺少带有“Make”的头文件当尝试为 PHP 构建 Xdebug 时
我正在尝试在 Linux 计算机上安装 Xdebug 以远程调试 PHP。我在尝试构建它时遇到了很多问题,我似乎已经解决了一些问题,但我现在感到陷入困境。简短描述,“make”未成功完成,表示找不到 zend_config.h 或 TSRM_config.h。不知道如何获取这些。
更深入的解释:(请注意,我不是超级精通 Linux,所以如果您发现我所做的事情是明显错误的,请告诉我)
我正在尝试按照我收到的说明进行操作 此处提供我的 phpinfo() 详细信息(请参阅帖子末尾)。我最初在尝试“make”时遇到了一些与这些类似的错误:
Error: ‘ZEND_USER_OPCODE_DISPATCH’ undeclared (first use in this function)
Error: ‘ZEND_RAISE_ABSTRACT_ERROR’ undeclared (first use in this function)
Etc.
我的猜测是它没有使用正确版本的 Zend 进行 phpize(如果我的措辞正确的话)。回到 phpize 步骤,返回的版本与 phpinfo() 不一致。而不是看到:
PHP Api Version: whatever
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
我反而看到:
PHP Api Version: 20020918
Zend Module Api No: 20020429
Zend Extension Api No: 20050606
为了让事情变得更复杂,我正在运行旧版本的 XAMPP (1.6.8a),它允许我在 PHP 4.4.9 和 PHP 5.2.6 之间切换(当前正在尝试转换 PHP 版本)在我的工作和调试中确实会加快速度)。我目前正在运行 PHP5 模式。检查/opt/lampp/bin/phpize,我发现它是“phpize-5.2.6”的符号链接。我的猜测是,XAMPP 只是根据被告知启动的 PHP 版本来切换链接。不管怎样,这部分看起来不错,我运行 phpize-5.2.6 进行健全性检查,但仍然得到旧版本号。现在,php-config 的设置类似,运行 php-config --version 返回“5.2.6”,这很好。
我做了一些更多的挖掘并浏览了这篇文章(线程中倒数第二个)。我最终下载了 5.2.17 版本的 PHP 源代码(希望足够接近)并创建了线程中描述的软链接。 Phpize 版本现在看起来好多了,并且与 Xdebug 站点所说的我应该看到的一致:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
“Make”现在抛出上面列出的缺少头文件的错误。我看到这篇文章并决定使用我的配置文件。
我注释掉
-no-create | --no-create | --no-creat | --no-crea | --no-cre \ <br/>
| --no-cr | --no-c | -n)
no_create=yes ;;
并从这一行中删除了 –no-create:
set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
仍然没有运气。我认为配置应该创建这些配置文件或其他东西?不确定下一步要尝试什么。如果有帮助,我正在运行 SUSE SLES 10。谢谢。
Xdebug custom generated install instructions:
SUMMARY
• Xdebug installed: no
• Server API: Apache 2.0 Handler
• Windows: no
• Zend Server: no
• PHP Version: 5.2.6
• Zend API nr: 220060519
• PHP API nr: 20060613
• Debug Build: no
• Thread Safe Build: no
• Configuration File Path: /opt/lampp/etc
• Configuration File: /opt/lampp/etc/php.ini
• Extensions directory: /opt/lampp/lib/php/extensions/no-debug-non-zts-20060613
INSTRUCTIONS
1. Download xdebug-2.1.0.tgz
2. Unpack the downloaded file with tar -xvzf xdebug-2.1.0.tgz
3. Run: cd xdebug-2.1.0
4. Run: phpize
As part of its output it should show:
Configuring for:
...
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
If it does not, you are using the wrong phpize. Please follow this FAQ entry and skip the next step.
5. Run: ./configure
6. Run: make
7. Run: cp modules/xdebug.so /opt/lampp/lib/php/extensions/no-debug-non-zts-20060613
8. Edit /opt/lampp/etc/php.ini and add the line
zend_extension = /opt/lampp/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so
9. Restart the webserver
I’m trying to install Xdebug on a Linux machine for remote debugging of PHP. I’ve come across a number of issues in trying to build it, I appear to have resolved some but I feel stuck right now. Short description, “make” does not complete successfully, says it can’t find zend_config.h or TSRM_config.h. Not sure how to go about getting these.
More in-depth explanation: (note I’m not super Linux savvy so if you see something that I’ve done that is blatantly wrong, please let me know)
I’m trying to follow the instructions I received here from providing my phpinfo() details (see end of post). I was originally getting a number of errors similar to these when trying to “make”:
Error: ‘ZEND_USER_OPCODE_DISPATCH’ undeclared (first use in this function)
Error: ‘ZEND_RAISE_ABSTRACT_ERROR’ undeclared (first use in this function)
Etc.
My guess was that it wasn’t phpize’d with the proper version of Zend (if I’m wording that correctly). Going back to the phpize step, the versions that are returned do not line up with phpinfo(). Rather than seeing:
PHP Api Version: whatever
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
I instead see:
PHP Api Version: 20020918
Zend Module Api No: 20020429
Zend Extension Api No: 20050606
To make things more complicated, I’m running an older version of XAMPP (1.6.8a) that allows me to switch between PHP 4.4.9 and PHP 5.2.6 (currently trying to transition PHP versions on my job and debugging would really speed things up). I currently have PHP5 mode running. Checking /opt/lampp/bin/phpize, I see that it’s a symbolic link to “phpize-5.2.6”. My guess is that XAMPP just switches the link depending on the version of PHP that it was told to start up with. Anyways, that part seems fine and I run phpize-5.2.6 for a sanity check and still get the old version numbers. Now, php-config is setup similarly, running php-config --version returns “5.2.6” which is just fine.
I do some more digging and run across this post (2nd to last in thread). I end up downloading the PHP source for version 5.2.17 (hopefully that’s close enough) and creating the soft link as described in the thread. Phpize versions look much better now and line up with what the Xdebug site says I should see:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
“Make” is now throwing the missing header file errors listed above. I see this post and decide to play around with my configure file.
I commented out
-no-create | --no-create | --no-creat | --no-crea | --no-cre \ <br/>
| --no-cr | --no-c | -n)
no_create=yes ;;
And removed –no-create from this line:
set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
Still no luck. I assume configure is supposed to create these config files or something? Not sure what to try next. If it helps, I’m running SUSE SLES 10. Thanks.
Xdebug custom generated install instructions:
SUMMARY
• Xdebug installed: no
• Server API: Apache 2.0 Handler
• Windows: no
• Zend Server: no
• PHP Version: 5.2.6
• Zend API nr: 220060519
• PHP API nr: 20060613
• Debug Build: no
• Thread Safe Build: no
• Configuration File Path: /opt/lampp/etc
• Configuration File: /opt/lampp/etc/php.ini
• Extensions directory: /opt/lampp/lib/php/extensions/no-debug-non-zts-20060613
INSTRUCTIONS
1. Download xdebug-2.1.0.tgz
2. Unpack the downloaded file with tar -xvzf xdebug-2.1.0.tgz
3. Run: cd xdebug-2.1.0
4. Run: phpize
As part of its output it should show:
Configuring for:
...
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
If it does not, you are using the wrong phpize. Please follow this FAQ entry and skip the next step.
5. Run: ./configure
6. Run: make
7. Run: cp modules/xdebug.so /opt/lampp/lib/php/extensions/no-debug-non-zts-20060613
8. Edit /opt/lampp/etc/php.ini and add the line
zend_extension = /opt/lampp/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so
9. Restart the webserver
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您似乎使用的是旧版本的 PHP,这可能意味着您正在使用 Linux 发行版中的 PHP 软件包。
如果是这种情况,请首先检查您的发行版是否提供了 xdebug 包。如果没有,您可能必须安装 php*-dev 或 php*-devel 软件包才能构建模块。
It looks like you are using an old version of PHP, which may mean that you are using a PHP package from your linux distribution.
If that's the case, first check if your distribution provides a xdebug package. If not, you may have to install the php*-dev or php*-devel package, in order to build a module.
事实证明,我在运行配置时需要一个额外的标志:
--enable-xdebug
非常简单,但我使用的说明从未提到过这一点。浏览 Xdebug 的讨论列表存档后才发现这一点。
请注意,虽然我第一次执行此操作时“make”似乎工作正常,但我仍然没有在 module/ 中获得 xdebug.so 文件。然后我做了一个“make clean”,再次运行 phpize,配置然后 make,这次我得到了文件。
So turns out I needed an additional flag when running configure:
--enable-xdebug
Pretty simple but the instructions I was using never mentioned this. Only found out about it after browsing through Xdebug's discussion list archive.
Note, though "make" seemed to work without error the first time I did this, I still did not get an xdebug.so file in modules/. I then did a "make clean", ran phpize again, configure and then make, this time I got the file.