sbrl / Pepperminty-Wiki

A wiki in a box
https://peppermint.mooncarrot.space/
Mozilla Public License 2.0
177 stars 20 forks source link

New install gives a Zip error #249

Closed daveschroeter closed 9 months ago

daveschroeter commented 11 months ago

PHP Fatal error: Uncaught ValueError: Invalid or uninitialized Zip object in /my_server/index.php:1825 Stack trace:

0 /myserver/index.php(1825): ZipArchive->extractTo()

1 {main}

thrown in /myserver/index.php on line 1825

I am on PHP 8.0 and verified that the zip module is installed. Any ideas?

daveschroeter commented 9 months ago

Update with further info: I'm on GoDaddy, I've verified the Zip PHP module is installed, and I get the error on PHP 8.0 and 8.1. Could this be a permissions issue?

sbrl commented 9 months ago

Hmmm. Is this shared hosting, or do you have root / sudo / admin / whatever you want to call it permissions over your hosting platform?

Can I also have the name and version of your operating system please? On Linux, run these commands and paste the output:

cat /etc/os-release
ls_release -a
uname -a

I can't reproduce this error, so I'm going to need more information.

Additionally, what version of Pepperminty Wiki are you using and where did you get it from?

sbrl commented 9 months ago

It may be a permissions issue, but I'm not sure. Either way, it's clearly not something I anticipated :P

If you do have admin access over your host, please check the user that your PHP server (or, httpd if you are using Apache) and ensure that you chown index.php and the entire directory it sits in to this user account.

For example, on my server PHP runs as www-data, so I do this:

sudo chown -R www-data:www-data path/to/directory

If this doesn't help and I can't track down the error from the additional info you provide above, I will produce a debug version of index.php for you that I'll ask you to test for me to gather more information.

sbrl commented 9 months ago

To summarise a Discord chat, the ZipArchive implementation on GoDaddy shared hosting does not work correctly.

Pepperminty Wiki from commit https://github.com/sbrl/Pepperminty-Wiki/commit/7698290ee5f8f9a85fbe911de04115d553858c8f and later will now generate a more useful error message. If you get the following text:

Oops! Unfortunately, Pepperminty Wiki wasn't able to unpack itself properly. This is likely either a server misconfiguration or a bug. ZipArchive, the extractor class used by Pepperminty Wiki says: The zip archive was inconsistent.

Please check that the zip extension is installed properly by inspecting the output of php -m, or running the phpinfo() command in a .php file on your webserver.

Therefore, Pepperminty Wiki is unable to unpack the extra data resources it needs to run. Further inspection revealed that the Libzip version was 1.3.2..... and the latest version on Ubuntu 23.04 is 1.7.3, and on libzip.org it's 1.10! Also, 1.3.2 was released on 20th November 2017!

As a workaround, please:

  1. Report the issue to your hosting provider and tell them to update their stuff, 'cause it's very very out of date
  2. Download and extract the following .zip and upload the ._extra_data directory contained within to sit alongside your index.php: extra_data.zip