enable JSON PHP 5.2.6

They have: 426 posts

Joined: Feb 2005

Hi All,

I am running a Gentoo server with PHP 5.2.6 JSON is not enabled and I cant figure out how to enable it.

In my phpinfo under configure command i have this "--disable-json' '"

From a bit of reading I think php was compiled with json disabled?

I tried enabling it in php.ini but adding extension=json.so but no luck.

Can anyone advise me.

If i need to recompile php how can I do this and will it effect my current set up.


davecoventry's picture

He has: 112 posts

Joined: Jun 2009

I think you have to change the USE flags when you install php, from memory.

Did you use portage?

Update your USE flags in ‘/etc/portage/package.use’ to something like this (all on one line):

dev-lang/php apache2 cgi ctype curl curlwrappers -doc exif fastbuild filter ftp hash inifile json mysql mysqli pdo pic posix sharedext sharedmem
simplexml sockets spell truetype xml xmlreader xmlrpc xmlwriter xpm zip

Then run 'emerge php'


pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

Looks like you can install it using PECL:

pecl install JSON

From this article: http://www.rockfloat.com/howto/gentoo-php-mysql.html

They have: 5 posts

Joined: Jul 2011

the a lot of above absolution of PHP came out, which is adaptation 5.2.6. This version, as with antecedent versions can be developed on a lot of web servers as able-bodied as abounding operating systems and platforms; it can as well be acclimated with abounding relational database administration systems. Aswell the PHP Group provides the complete antecedent code, which allows users to body and customise as able-bodied as extend it to fit their own use.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.