/
update PHP7.3 to PHP8.1

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:

  1. check what php version we currently have.

  2. Uninstall php

    sudo yum remove php* sudo yum remove /etc/php*
  3. check that php is completely removed

    whereis php php -v
  4. After removing the packages, clean up your system:

    sudo yum clean all
  5. 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:

  6. Enable PHP Repository via Amazon Linux Extras

  1. Install all php packages that are required for moodle to operate.

    1. first install PHP

    2. 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.

 Related articles

Related content

Procedure for Updating Moodle
Procedure for Updating Moodle
More like this
Update EC2 instance from Amazon Linux 1 to Amazon Linux 2
Update EC2 instance from Amazon Linux 1 to Amazon Linux 2
More like this
Install libsodium php package in AWS instances
Install libsodium php package in AWS instances
More like this
How to Update Your Moodle Profile
How to Update Your Moodle Profile
More like this
How to update your Moodle Profile
How to update your Moodle Profile
More like this
LMS For Developers
LMS For Developers
More like this