update PHP7.3 to PHP8.1
In order for moodle to be updated to newer versions the update of php version is inevitable. PHP8.1 will guarantee us the opportunity to update to moodle version 4.2. Note that the update must be condacted into a dev environment first. All custom plugins,themes,scripts must also be checked thorougly so we make sure that everything is working as it should.
Instructions
Instructions on how to install it on our EC2 instances. We take for granted that we already have Amazon Linux 2 installed with amazon-linux-extras.
The steps are as follows:
check what php version we currently have.
Uninstall php
sudo yum remove php* sudo yum remove /etc/php*
check that php is completely removed
whereis php php -v
After removing the packages, clean up your system:
sudo yum clean all
Disable Any Third-Party PHP Repositories. If you have any third-party repositories enabled (like Remi or EPEL), you should disable them to avoid conflicts:
Enable PHP Repository via Amazon Linux Extras
Install all php packages that are required for moodle to operate.
first install PHP
all php packages that are required
The iconv extension is required.
The mbstring extension is required.
The curl extension is required (required for networking and web services).
The openssl extension is recommended (required for networking and web services).
The tokenizer extension is recommended.
The xmlrpc extension is recommended (required for networking and web services).
The soap extension is recommended (required for web services).
The ctype extension is required.
The zip extension is required.
The gd extension is required.
The simplexml extension is required.
The spl extension is required.
The pcre extension is required.
The dom extension is required.
The xml extension is required.
The intl extension is required.
The json extension is required.
the opcache extension is not required but moodle displays a warning to be installed as well.
The appropriate extension for your chosen database is also required.
mysqlnd
The redis extension for our case needs to be installed as well. There is a case where amazon-linux-extras might not include redis into their packages and for that reason we need to go with a third party repository like remi.
After installing redis it’s a good idea to go back to amazon-linux-extras repository.
After installing all the php packages it is mandatory to change the max_input_vars to 5000. This can be found in /etc/php.ini
It's always a good idea to check Moodle's phpinfo() page, as well as Moodle's environment page, to ensure that all services are enabled and functioning properly.