Question

Problem with JSON PHP extension.

Posted March 11, 2014 10k views
Hello, how i can install that extension? I install cURL and that's ok.. but now i need to install that. I create facebook connect on my web page. Here is link with my error : http://stefanvukovic.me/facebooksdk/fblogin.php *i send ticket for this.. and i'am sorry.. now i see this community.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
6 answers
sudo apt-get install php5-common
when i do that i get this :

Reading package lists... Done
Building dependency tree
Reading state information... Done
php5-common is already the newest version.

And my error is this :
"Fatal error: Uncaught exception 'Exception' with message 'Facebook needs the JSON PHP extension.' in /var/www/stefanvukovic.me/public_html/facebooksdk/src/base_facebook.php:22 Stack trace: #0 /var/www/stefanvukovic.me/public_html/facebooksdk/src/facebook.php(18): require_once() #1 /var/www/stefanvukovic.me/public_html/facebooksdk/fblogin.php(5): include('/var/www/stefan...') #2 {main} thrown in /var/www/stefanvukovic.me/public_html/facebooksdk/src/base_facebook.php on line 22"


I would try enabling the extension in your php5 config file. It might vary depending on your Linux distro and version of php you're using. Google will surely help you.
What result do you get if you run this PHP snippet:

echo function_exists( 'json_decode' );
?>

The JSON extension is included by default in PHP, but just to be sure, you can verify it by looking through PHP's info output:

phpinfo();
?>
The JSON extension is no longer included with the base php package, you need to install it separately:
sudo apt-get install php5-json

That did the trick… thanks.

Submit an Answer