CentOS install PHP Json Extension by using PECL

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:

pecl install json

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:

; Enable json extension module
extension=json.so

4. Restart your apache server by command below:

service httpd restart

5. Test your work:

php -r 'var_dump(function_exists("json_encode"));'

It should returns something like: bool(true)

That’s all, enjoy with PHP JSON Extension.

GD Star Rating
loading...
GD Star Rating
loading...

Related Articles

Random Articles

Post a Comment