How to fix Symfony ClassNotFoundException

| | 1 min read

Some of you might have seen this error message while trying to upgrade Mautic in your system:

"[Symfony\Component\Debug\Exception\ClassNotFoundException]       
Attempted to load class "ZipArchive" from the global namespace.  
Did you forget a "use" statement?" while upgrading Mautic version.

We have received the error while trying to upgrade the Mautic version from 3.3.3 to the 3.3.4 version. The apply-update gets aborted by showing the error mentioned. The issue was that the PHP version was missing the zip extension.

Here is how we overcame it: 

Since we are using the PHP 7.4 version on an Ubuntu OS, we installed the extension using the below command.

sudo apt-get install php7.4-zip

After installation, restarted the apache service using the below command

service apache2 restart

Once we completed this step, we were able to upgrade the version of Mautic without the error.