PHP的致命错误:调用未定义的函数json_de code() [英] PHP Fatal error: Call to undefined function json_decode()
问题描述
Apache是登录 PHP致命错误:调用未定义的函数json_de code()
。一些google搜索后,看来这个问题是不具有最新版的PHP的结果。奇怪的是,运行 PHP --version
。OUPUTS
Apache is logging PHP Fatal error: Call to undefined function json_decode()
. After some googling, it seems this problem is a result of not having the latest version of php. Oddly, running php --version
ouputs
PHP 5.5.1-2+debphp.org~precise+2 (cli) (built: Aug 6 2013 10:49:43)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
with Zend OPcache v7.0.2-dev, Copyright (c) 1999-2013, by Zend Technologies
with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
这清楚地表明我的 PHP
版本比 5.1更大
。
任何想法,这是什么原因,还是要采取的步骤,找出?
Any ideas as to what could cause this, or the steps to take to find out?
编辑:脚本呼应phpversion的结果是 5.5.1-2 + debphp.org〜precise
The result of a script echoing phpversion is 5.5.1-2+debphp.org~precise
编辑:的结果的phpinfo()
也 PHP版本5.5.1-2 + debphp.org〜precise + 2
此外,在的phpinfo()
,它列出了JSON模块和模块作者(奥马尔Kilani,斯科特MacVicar)。
Furthermore, in the phpinfo()
, it lists the module JSON and the module authors (Omar Kilani, Scott MacVicar).
推荐答案
简短的回答:
sudo apt-get install php5-json
然后当然确保您重新启动Apache
sudo service apache2 restart
或者,如果你使用的是PHP-FPM:
Or if you are using PHP-FPM:
sudo service php5-fpm restart
说明
Debian的去掉了previous JSON扩展作为PHP 5.5rc2由于许可证冲突。
Explanation
Debian has removed the previous JSON extension as of PHP 5.5rc2 due to a license conflict.
具有规定的条款的 JSON许可证:
The JSON license has a clause which states:
软件应使用好,不是罪恶。
The Software shall be used for Good, not Evil.
这会导致自由软件的自由软件基金会的定义问题的规定:
This causes a problem with Free Software Foundation's definition of free software which states:
自由运行程序,出于任何目的(自由0)。
The freedom to run the program, for any purpose (freedom 0).
FSF接着专门列出了JSON牌照非自由。
是的,它似乎有点傻。不过Debian的已删除不符合规定的JSON扩展,而是提供了一个更换扩展指功能相当。
Yes it seems a bit silly. Nevertheless Debian has removed the non-compliant JSON extension, and instead offered a replacement extension that is functionally equivalent.
需要明确的是:PHP本身并没有删除JSON,这是仍处于主 。这是一个发行版/包管理器的问题。
To be clear: PHP itself has NOT removed JSON, it's still in master. This is a distro / package manager issue.
我们没有删除JSON和我们永远不会发布一个版本的PHP没有内置JSON支持。在5.5的任何变化的原因是什么发行包装使用的是我们无法控制的。
We have not removed json and we will never release a version of php without json support built in. Any changes in 5.5 is due to whatever distro packaging you are using which we have no control over.
<一个href=\"http://iteration99.com/2013/php-json-licensing-and-php-5-5/\">http://iteration99.com/2013/php-json-licensing-and-php-5-5/
<一个href=\"http://liorkaplan.word$p$pss.com/2013/06/01/bye-bye-non-free-php-json-extension/\">http://liorkaplan.word$p$pss.com/2013/06/01/bye-bye-non-free-php-json-extension/
https://bugs.php.net/bug.php?id=63520
<一个href=\"http://philsturgeon.co.uk/blog/2013/08/fud-cracker-php-55-never-lost-json-support\">http://philsturgeon.co.uk/blog/2013/08/fud-cracker-php-55-never-lost-json-support
这篇关于PHP的致命错误:调用未定义的函数json_de code()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!