Celeb Glow
updates | March 31, 2026

Adding the PHP json extension

I have Ubuntu 15.10 installed. I have also installed LAMP using the Ubuntu wiki help page. I then proceeded to set up Moodle via the web page installation. I hit a road block when I got

Moodle requires the json PHP extension.
Please install or enable the json extension.

With the link above, I have tried installing, whilst LAMP was still installed, only PHP5 (libapache2-mod-php5) -- and of course restarting the apache2 service. The problem is in the the /etc/php5/mods-available folder, no json.ini file appears. When I type in terminal sudo php5 -m, json is not a module running. However if I attempt to remove PHP5, it shows before I confirm the removal that the package php5-json will go.

The question I have is how do I get the json extension if I don't have it already, or if I do have it (and it's placed somewhere else) how do I enable it?

EDIT: output of apt-cache policy php5-json

php5-json: Installed: 1.3.7-1 Candidate: 1.3.7-1 Version table: *** 1.3.7-1 0 500 wily/main amd64 Packages 100 /var/lib/dpkg/status

Tried sudo apt-get install --reinstall php5-json but still missing file.

10

1 Answer

  1. Open the file /etc/php5/apach2/php.ini

  2. Add this line to the end of the file.

    extension=json.so
  3. restart apache2

    sudo service apache2 restart
1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy