1

I realize this question has been asked again and again but I'm not sure why none of the solutions aren't working for me. Possible duplicate: Fatal error: Class 'ZipArchive' not found in

I've already installed the extension and changed the php.ini file.

enter image description here

In php.ini I added extension=zip.so

I'm using PHP 7.3.11 on MacOS v11.4 (Big Sur). Also, I'm using AMPP v3.9.

What else can I do?

Ismail Farooq
  • 145
  • 1
  • 3
  • 13
  • If you are using it in another namespace you have to `use ZipArchive` to import from global namespace or use \ for global namespace: `new \ZipArchive()`. – Code Spirit Jul 12 '21 at 08:44
  • Okay so I tried both ways, `use ZipArchive; $sip = new ZipArchive;` and `$sip = new \ZipArchive();`. It's giving me the same error. – Ismail Farooq Jul 12 '21 at 09:49
  • Only guess I have left is that you are using diffrent config file? Are you using ZipArchive in same context you have done `phpinfo()` in or are you running it on cli? Maybe you have multiple php versions with different config? – Code Spirit Jul 12 '21 at 10:29
  • Yeah, I thought so too but no, I'm using the same configurations. One thing I've noticed is that ZipArchive is working fine in the root directory of the project but not when used in a file in a folder. Weird. – Ismail Farooq Jul 12 '21 at 10:37
  • So for anyone who sees this, I was using ZipArchive in a script. Whenever I ran it using the browser (entering the URL) it didn't work but when I ran it using CLI, it worked fine! Still not sure why this is happening but will update once I know more. – Ismail Farooq Jul 13 '21 at 07:17

0 Answers0