This tutorial will show you steps to install PHP Json Extension on your Linux web server, this case is CentOS. This process is very fast and simple.
Here you go:
1. Login to SSH with your root account or who else can install stuff on your server.
2. Run command below:
[text] pecl install json[/text]
Note: if you’re getting an error message likes: “-bash pecl command not found”, read this post will help you to solve the issue.
3. Enable Json extension in php.ini
Create a new file in /etc/php.d/ named json.ini with content below:
[text] ; Enable json extension moduleextension=json.so
[/text]
4. Restart your apache server by command below:
[text] service httpd restart[/text]
5. Test your work:
[text] php -r ‘var_dump(function_exists("json_encode"));’[/text]
It should returns something like: bool(true)
That’s all, enjoy with PHP JSON Extension 🙂