I've had to upgrade my CentOS PHP package to 5.2.10 to enable the JSON extension, but it's not gone 100% smoothly. Naturally..

I used this guide: http://wiki.centos.org/HowTos/PHP_5.1_To_5.2

On completing "yum update", "php -v" showed a bunch of extension errors so I updated those using "pecl upgrade [package]". That reduced the number of warnings down to one:

PHP Warning: Module 'readline' already loaded in Unknown on line 0

I've tried updating this package individually but neither yum or pecl can find it (not installed apparently) despite the readline.so sitting in /usr/lib/php/modules/. I know you need to compile php using -readline, is this now my only option: a complete recompile from fresh?

I hope not.

Anyone able to help? Thanks.


5.3 is indeed out and works fine with plesk. To get JSON running had to:

  • Update yum with this Plesk / CentOS focused rpm http://www.atomicrocketturtle.com
  • Disable plesk sitebuilder functionality (conflict with new PHP version)
  • pecl uninstall / reinstall of json package
  • double checked it was being called from etc/php.d/
  • chmod 755 /usr/lib/php/modules/json.so
  • service httpd restart

I know json is included in php-common from 5.2 upwards, but this seemed to fix it regardless. Uninstalling via pecl left it working too.


If an even newer PHP is not a problem (PHP 5.3), it is now available for CentOS 5.6.

The packages are named php53 instead of php, and the json module is part of the php53-common package.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.