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 --versionPHP 7.4.30 (cli)
sudo apt updatesudo apt upgradesudo 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 gnupg2echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/sury-php.listcurl -fsSL https://packages.sury.org/php/apt.gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/sury-keyring.gpgsudo apt updatesudo apt updatesudo apt install php8.1php --versionPHP 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-zipa2dismod php7.4ERROR: Module php7.4 does not exist!
a2enmod php8.1Module php8.1 already installed
systemctl restart apache2
Alright, can I still reach Monica? Yes I can. Wonderful!
sudo apt update5 packages can be upgraded
sudo apt upgrade -ycd /var/www/monicagit fetchfatal: 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/monicagit fetchgit checkout tags/v4.0.0composer install --no-interaction --no-devyarn installyarn 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 nodejsyarn install
Success!yarn run productionwebpack compiled successfully
php artisan monica:update --forceMonica 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/phpsudo apt updatesudo 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-zipa2enmod php8.1ERROR: Module php8.1 does not exist
sudo apt install libapache2-mod-php8.1a2enmod php8.1Module 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.