Yashar Khavan
Yashar Khavan

Reputation: 1645

The json extension is missing. Please check your PHP configuration

I install PHP5.6.0 on Ubuntu 13.10 x64 from this

https://launchpad.net/~ondrej/+archive/php5-5.6a

then I installed phpmyadmin when I am trying to lunch phpmyadmin I got this message

The json extension is missing. Please check your PHP configuration.

my PHP modules:

bcmath
bz2
calendar
Core
ctype
date
dba
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
libxml
mbstring
mcrypt
mhash
mysql
mysqli
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
Zend OPcache
zip
zlib

[Zend Modules] Zend OPcache

then when i use this command to install php-json

sudo apt-get install php5-json

I got this

The following packages have unmet dependencies:
php5-json : Depends: phpapi-20121212
E: Unable to correct problems, you have held broken packages.

How can I fix this problem?

Upvotes: 3

Views: 15708

Answers (4)

prasoon
prasoon

Reputation: 901

Below solution worked for me-

cd /etc/php5/mods-available
vi json.ini

In this file make below changes

priority=20
extension=json.so

Incase if json.ini file is not there, create the file with contents as

priority=20
extension=json.so

Upvotes: 2

Ivan Nieto
Ivan Nieto

Reputation: 1

It worked for me after loading the installed modules json and mcrypt.

$ sudo php5enmod json && sudo php5enmod mcrypt $ sudo service apache2 restart

Go to http://yourserver/phpmyadmin and take a look to check if it works.

Upvotes: 0

nucc1
nucc1

Reputation: 374

The problem seems to me to be because of Ubuntu's default permissions for the php.ini files. It only allows Root to read/execute the directories holding the in files.

You can easily verify this by observing that when you execute: sudo php -m

You see all installed and enabled modules listed correctly.

The solution to this I have found on ubuntu distros is to:

sudo chmod a+rx /etc/php5/cli/
sudo chmod a+rx /etc/php5/cli/php.ini
sudo chmod a+rx /etc/php5/cli/conf.d/

Then you can easily verify by running:

php -m

Upvotes: 0

Lance Badger
Lance Badger

Reputation: 812

It looks like you are install PHP5 from a custom repo. I would remove PHP and remove that repo.

sudo apt-add-repository --remove ppa:ondrej/php5-5.6
sudo apt-get update

now install php

sudo apt-get install php5-common php5-json

Upvotes: 2

Related Questions