How to add / install JSON support to PHP on CentOS in 10 Steps
Author: Ashvin Savani - Arckid
7
Aug
We are using staging server inside our organization (CentOS) to test the applications that we work on. We heavily use AMFPHP based PHP services to do communication between business logic and client front end in flash.
Team requested to have native JSON support for PHP and I found a very simple way to do it as following:
- Login to shell prompt with user credentials (which allows you to install stuff on server).
- Execute command yum update “*php*”
- This should update all PHP related components to the latest version. (Assuming you installed yum etc., on CentOS)
- Once done that, You will require to install Pear based JSON support by following command.
- pecl install json
- This will install JSON, simply wait and cross your fingers! If it says OK in last 2 lines, everything is fine so far.
- You will also require to enable JSON support in php.ini
- Smart way to do that is, create a new file in /etc/php.d/ called json.ini
- The file should contain this line: extension=json.so
- Finally, restart the HTTP (Apache) Server by command: service httpd restart
Done! Here is the all keyboard actions together, after you logged in:
yum update “*php*”
pecl install json
cd /etc/php.d/
echo “extension=json.so” >> json.ini
service httpd restart
10 Responses for "How to add / install JSON support to PHP on CentOS in 10 Steps"
Thanx a lot for the valuable information
[...] public links >> php How to add / install JSON support to PHP on CentOS in 10 Steps First saved by juanitaWinters | 2 days ago PHP 5.3 and Closures First saved by TSimonetta | 6 [...]
Hi, it’s a bit more than that, unless you really have all the development libs, gcc and friends installed on the web server.
You have to install:
* php-pear
* php-devel
* gcc
* make
THEN it will compile.
Never assume that everyone has installed the same set of RPMs as you have.
Thx man. This helped us out of a tight spot.
[...] – How to add / install JSON support to PHP on CentOS in 10 Steps saved by sagaboi2009-08-10 – Adding Ant to Flex Builder 3 saved by finnell2009-08-10 – Flex 4 Sneak [...]
[...] to arckid & phpfreaks. document.getElementById("post-991-blankimage").onload(); Other Important Articles [...]
Worked perfectly. Thanks a lot!
Thanks. Doing
echo “extension=json.so” >> json.ini
I had to remove the quotation marks from the json.ini file to get the module to load.
Joss,
You can also use single quotes. i.e. echo ‘extension=json.so’ >> json.ini
I am not sure it should work without quotes at all.
You’re welcome my friend
Leave a reply