Starting from Moodle version 4.0, the Zip PHP extension is a mandatory requirement. This means that Moodle no longer relies on info-ZIP binaries or the PclZip library for handling zip archives. Here’s what you need to do to ensure Moodle works properly:
Steps to Enable the Zip PHP Extension:
- Check if the Zip extension is installed:
- Run the following command to check if the zip extension is installed:
php -m | grep zip
If the zip extension is listed, then it is installed.
2. Install the Zip extension (if not installed):
For Ubuntu/Debian:
sudo apt-get install php-zip
sudo systemctl restart apache2
For CentOS/RHEL:
sudo yum install php-zip
sudo systemctl restart httpd
For Windows:
- Open your
php.ini
file. - Uncomment (or add) the following line:
extension=zip
- Restart the web server (e.g., Apache or IIS).
3. Verify the Installation:
- After installation, verify that the extension is enabled by running:
php -m | grep zip
4. Restart Web Server:
- Make sure to restart the web server after enabling the Zip extension for the changes to take effect.
Why Moodle Needs the Zip Extension:
- The Zip extension is used for packaging and unzipping files, which is a core part of Moodle’s functionality, especially for importing courses, themes, and plugins.
- The removal of info-ZIP and PclZip libraries improves Moodle’s performance, reliability, and security.
By following these steps, Moodle will be able to handle zip operations properly, and you should avoid any errors related to missing Zip functionality.