Upgrade Monica to v4.0
So the Monica CRM Team has put out a major release update, version 4.0. This has a breaking change that requires a newer version of PHP, PHP8.1. What version of PHP do I have on MONICA-01?
php --version
PHP 7.4.30 (cli)
sudo apt update
sudo apt upgrade
sudo reboot
With the virtual machine up to date and rebooted I jump over to Windows Admin Center and create a snapshot....errr checkpoint. That way if I mess something up I can always revert back to try again.
sudo apt install -y lsb-release ca-certificates apt-transport-https software-properties-common gnupg2
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/sury-php.list
curl -fsSL https://packages.sury.org/php/apt.gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/sury-keyring.gpg
sudo apt update
sudo apt update
sudo apt install php8.1
php --version
PHP 8.1.2-lubuntu2.10 (cli)
Now I need to install all the PHP8.1 extensions Monica needs. I pull the list from my documentation.
sudo apt install -y php8.1 php8.1-bcmath php8.1-cli php8.1-curl php8.1-common php8.1-fpm php8.1-gd php8.1-gmp php8.1-intl php-json php8.1-mbstring php8.1-mysql php8.1-opcache php8.1-redis php8.1-xml php8.1-zip
a2dismod php7.4
ERROR: Module php7.4 does not exist!
a2enmod php8.1
Module php8.1 already installed
systemctl restart apache2
Alright, can I still reach Monica? Yes I can. Wonderful!
sudo apt update
5 packages can be upgraded
sudo apt upgrade -y
cd /var/www/monica
git fetch
fatal: detected dubious ownership in repository at '/var/www/monica' to add an exception for this directory, call: git config --global --add safe.directory /var/www/monica
sudo git config --global --add safe.directory /var/www/monica
git fetch
git checkout tags/v4.0.0
composer install --no-interaction --no-dev
yarn install
yarn install v1.22.18
[1/5] Validating package.json...
error @: The engine "node" is incompatible with this module. Expected version "18.x". Got "16.18.0"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
yarn install --force
I get the same error.
yarn install --ignore-engines
Same error. Ok slow down a moment. Node is out of date. I did install a version 16 in the original walkthrough. So how to update node?
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - && sudo apt install -y nodejs
yarn install
Success!yarn run production
webpack compiled successfully
php artisan monica:update --force
Monica v4.0.0 is set up, enjoy.
Awesome! So when I try to go to the webpage I get the error message:
Composer detected issues in your platform: Your composer dependencies require a PHP version ">=8.1.0"
Well OK then. Let's fix the dependencies.
composer -vw about 25>&1 | grep "PHP"
Running 2.4.5 with PHP 8.1.2
sudo apt purge php8.*
sudo apt purge php7.*
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install -y php8.1 php8.1-bcmath php8.1-cli php8.1-curl php8.1-common php8.1-fpm php8.1-gd php8.1-gmp php8.1-intl php-json php8.1-mbstring php8.1-mysql php8.1-opcache php8.1-redis php8.1-xml php8.1-zip
a2enmod php8.1
ERROR: Module php8.1 does not exist
sudo apt install libapache2-mod-php8.1
a2enmod php8.1
Module php8.1 is alredy enabled
sudo systemctl restart apache2
Now I'm getting a 404 error. Not any better. Wait a minute....I have strayed off the path and had been trying local addresses. Now I remember those all got broken when I was getting Apache to redirect HTTP to HTTPS on this build for some reason. I go to the primary address and poof it's working! Hooray!
One last thing I quickly delete the checkpoint I made from Windows Admin Center.