php and apache2 on Ubuntu (clean install for composer)

I had multiple issues in getting a clean setup for composer.

WARNING: Module json ini file doesn't exist under /etc/php/7.2/mods-available
Moodle requires the json PHP extension. Please install or enable the json extension.

And many more.

In order to get a clean set-up. I fully uninstalled php and apache2 . The purge command is the trick here as it also removed configuration files.
Please pay attention in your environment. This means all your apache and php configuration is gone afterwards. If you want to keep it make backups of  the most important files like php.ini and apache2.conf

Afterwards execute the following commands.

sudo apt purge php*

sudo apt purge apache2*

sudo apt install apache2

sudo apt install php libapache2-mod-php php-mysql

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"

sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer

 

Leave a Reply

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