It depends on which version of PHP you have, actually. Generally, you would expect this to be all that is needed, especially since it runs: sudo apt-get install php-zip
, but this didn't work for me. The solution is PHP-version dependent.
For the three major versions of PHP available right now, the last one here (which actually matches my version 8.1) worked for me:
PHP 5.6
sudo apt-get install php5.6-zip
PHP 7.0
sudo apt-get install php7.0-zip
PHP 8.0
sudo apt-get install php8.0-zip
And don't forget to restart apache after installing!
One of these should restart Apache:
systemctl restart apache2/etc/init.d/apache2 restartsudo service apache2 graceful