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 JSON.org “politely refuses” to amend the clause. The response from PHP has been to remove the standard PHP JSON extension as of PHP 5.5rc2.

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()

Solution

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.

Sources:

Share and Enjoy

  • Facebook
  • Twitter
  • Google Plus
  • LinkedIn
  • Pinterest
  • StumbleUpon
  • Email
  • Add to favorites

5 thoughts on “PHP JSON licensing and PHP 5.5

  1. Hey this is not an Issue with php this is an Issue with debian package maintainers. People using other repositories should not have any problems. Read the bug report carefully now

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>