PHP JSON licensing and PHP 5.5

What has happened?

JSON, a widely popular data interchange format, has ended up in a licensing conflict with Linux distributions over a clause in its license which states:

“The Software shall be used for Good, not Evil.”

This does not agree with the Free Software Foundation’s (FSF) freedom 0:

“The freedom to run the program for any purpose.”

While it may seem trivial, the author of “politely refuses” to amend the clause. The response from certain Linux distributions has been to remove the standard PHP JSON extension as of PHP 5.5rc2 from their respective package managers.

Depending on your set up, JSON may not be available after upgrading to PHP 5.5. Ideally, your package manager will take care of everything for you and replace the PHP JSON standard extension with a replacement, JSON-C. Otherwise, any code using the removed extension will result in the following errors:

  • PHP Fatal error: Call to undefined function json_encode()
  • PHP Fatal error: Call to undefined function json_decode()


If JSON becomes unavailable after upgrading to PHP 5.5, you may install the PECL JSON-C extension developed by Remi, which utilises the json-c library.

Installing the PECL JSON-C extension from Remi’s repository for YUM:

yum --enablerepo=remi install php-pecl-jsonc

If you are installing manually, be sure to disable the old PHP JSON extension in your php.ini configuration.


Share and Enjoy

  • Facebook
  • Twitter
  • Google Plus
  • LinkedIn
  • Reddit
  • Pinterest


  1. By Tobias


  2. By Pit r


  3. By Michael Gale


  4. By Vivek Gounder


    • By Iteration 9


  5. By nc


Leave a Reply

Your email address will not be published. Required fields are marked *