PHP 5.3.8、JSON 和中央操作系统 6

2022-01-13 00:00:00 json centos centos6 php apache

我们正在运行 CentOS 6 和 PHP 5.3.8(作为 apache 模块),它们应该将 JSON 作为其核心的一部分(有人告诉我).查看命令行上的 # php -i 我可以在配置命令下看到 '--enable-json=shared' ...太棒了!

We're running CentOS 6 and PHP 5.3.8 (as an apache module) which should have JSON as part of it's core (I'm told). Looking at # php -i on the command line I can see under Configure Command '--enable-json=shared' ... great!

但是,查看网页上的 php_info() 配置命令会显示 '--disable-json'.

However, looking at php_info() on a web page Configure Command shows '--disable-json'.

我想没问题,我会使用 pecl 安装它:

No problem I thought, I'll just install it using pecl:

# yum update php
# yum install php-pear
# yum install gcc
# pecl install json
# service httpd restart

成功了,我认为这一切都可以.然而 php -m 显示:

Success, that aught to do it I thought. However php -m shows:

PHP 警告:PHP 启动:无法加载动态库 '/usr/lib64/php/modules/json.so' -/usr/lib64/php/modules/json.so:未定义符号:在线未知中的 ZVAL_DELREF0

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/json.so' - /usr/lib64/php/modules/json.so: undefined symbol: ZVAL_DELREF in Unknown on line 0

抱歉,如果这是一个愚蠢的问题,但有谁知道这里发生了什么,您能否指出正确的方向来解决这个问题,以便 JSON 开始工作?

Apologies if this is a silly question but does anyone know what's going on here and could you point me in the right direction on how to fix this so that JSON starts working?

非常感谢

推荐答案

我想我会跟进解决方案.PECL 安装似乎与 PHP 5.3.8 冲突,因此经过一些研究和一些建议,我玩弄了以下想法:

Thought I'd follow up with the solution. The PECL installation seemed to conflict with PHP 5.3.8 so after a bit of research and some advice I toyed with the idea of:

# yum remove php
# yum install php

然而,在进一步的建议之后,改为:

However, after further advice instead went with:

# yumdownloader php-common
# rpm -Uvh --force php-common*.rpm
# service httpd reload
# rm php-common*.rpm

这成功了,JSON 现在又可以工作了.希望这对其他人有帮助.

This did the trick and JSON is now working again. Hope this helps someone else.

谢谢

相关文章