安装

自 PHP 5.2.0 起,JSON 扩展默认内置并编译进了 PHP。

安装此 PECL 扩展相关的信息可在手册中标题为 PECL 扩展的安装章节中找到。更多信息如新的发行版本、下载、源文件、 维护人员信息及变更日志等,都在此处: » https://pecl.php.net/package/json

User Contributed Notes

Anonymous 08-Apr-2020 07:32
even though the manual says the json extension is enabled by default and compiled into the core, I had to do a "yum install php-json" on centos 8 running php 7.2
YesCT 27-Jun-2014 07:44
on CentOS php 5.5.13 had to:
yum install php55u-pecl-jsonc php55u-pecl-jsonc-devel
ferenczy at NOSPAM dot volny dot cz 11-Dec-2013 03:46
On Ubuntu 13.10 you have to install this extension first (PHP 5.5.3):

   apt-get install php5-json

(Don't forget to restart web server.)
haebler at gmail dot com 22-Jan-2011 09:45
On RHEL5/CentOS5 add the EPEL repository (http://fedoraproject.org/wiki/EPEL).

After that, installation is as simple as:

    sudo yum install php-pecl-json
cko at audaxis dot com 19-Oct-2010 06:11
On gentoo, need the USE flag "json" to compile into php
dave at davidhbrown dot us 20-Jan-2009 04:24
On one server I use (FreeBSD 6.3; PHP 5.2.6 as module in Apache 2.2.10), PHP was compiled with the '--disable-all' configuration option. Consequently, there exists a secondary configuration file -- /usr/local/php5/etc/extensions.ini -- in which the line

; extension=json.so

must be uncommented (delete the semicolon) and Apache restarted for these functions to be available.
PHP8中文手册 站长在线 整理 版权归PHP文档组所有