Fatal error: Call to undefined function json_encode()
I subsequently Googled around and came across a highly-ranked blog article which makes it sound like PHP 5.5 drops support for json_encode because of some silly licensing argument. The truth is, PHP 5.5 does NOT drop support for json_encode. For a much better and much clearer explanation, I recommend reading this article.
Now, enough of the balleyhoo! How do we fix it?
It was was easy! Install the php5-json package and restart Apache. VoilĂ !
sudo apt-get install php5-json sudo /etc/init.d/apache2 restart
Note that the author of the blog article linked above mentions that re-installing the php5-dev pacakged fixed his woes. While that didn't help me, you may want to give it a try if the above didn't help you.
Awesome thanks for posting this!
ReplyDeleteI didn't receive an error at all, but this problem was screwing with the page load speeds of one of my dev WordPress installations.
It's now fixed by specifically installing php5-json, Thanks.
Hi everyone,
ReplyDeleteI've been having trouble with the son_encode for quite some time now, and I finally figured it out.
You simply have to make sure that your connection as well as the file is uff-8 encoded. The connection used to be irrelevant before PHP 5.5.
Kind regards