Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I'm experiencing a performance problem epubreader.php #531

Open
viking-k opened this issue Jan 15, 2024 · 21 comments
Open

I'm experiencing a performance problem epubreader.php #531

viking-k opened this issue Jan 15, 2024 · 21 comments

Comments

@viking-k
Copy link

COPS 1.5.4 on Synology. When I try to view epub, it gives the following message

300 Fatal error: Uncaught Exception: Failed to read epub file in /volume1/web/cops/vendor/mikespub/php-epub-meta/src/EPub.php:

that is, an error in opening the ZIP file

  /**
     * Summary of openZipFile
     * @param string $zipClass
     * @throws \Exception
     * @return void
     */
    public function openZipFile($zipClass)
    {
        $this->zip = new $zipClass();
        if (!$this->zip->Open($this->file)) {
            throw new Exception('Failed to read epub file');
        }
        $this->zipClass = $zipClass;
    }

What could be the reason?

@marioscube
Copy link

@viking-k

Can you unzip the epub manually with unzip on the Synoligy?

It might be broken.

@viking-k
Copy link
Author

You are right. indeed unzip is broken.

which 7z -> /bin/7z
which zip -> /bin/zip
which unzip -> nil

how to change the unzip command (or unzipper) in COPS?

@marioscube
Copy link

@viking-k

1 - COPS works with php-zip. I do not think that is available from the command line.

2 - do you get this error with every epub file or just with 1 particular epub file?

3 - Usually zip can be used to unzip as well. Use zip (or 7z) to try to unzip the epub file. This to check if this epub file is corrupted.

@viking-k
Copy link
Author

viking-k commented Jan 24, 2024

  1. Checked, PHP ZIP extensions are enabled. (zip, zlib)
    image

  2. Error with any EPUB file. Even from demo site (https://cops-demo.slucas.fr/download/20/Alice%27s%20Adventures%20in%20Wonderland%20-%20Lewis%20Carroll.epub)

  3. Yes, EPUB file is unpacked correctly on NAS (7z x file.epub).

@marioscube
Copy link

@viking-k

Your best bet to solve this is to repost your problem, together with the info from your last post, on https://github.com/mikespub-org/seblucas-cops/issues.

@dunxd
Copy link

dunxd commented Jan 24, 2024

Rather than repost, first try installing a more recent version of COPS available at https://github.com/mikespub-org/seblucas-cops/ as a number of bugs have been squashed. If you still get the same issue then please post an issue there.

Do be careful to read the readme first, as which version to install depends on what version of PHP you are running on your Synology.

@marioscube
Copy link

@dunxd

If the most recent version of PHP on the Synology is 7.4 @viking-k has probably installed the most recent compatible version of (new) COPS. Support from that site?

@viking-k
Can you install PHP 8.1 on your synology (not saying you should)?
With what client are you using COPS (eg. Windows Edge)?

Maybe reinstall COPS 1.5.4 ?

@marioscube
Copy link

marioscube commented Jan 24, 2024

@viking-k @dunxd

Issue confirmed!

Installed. latest COPS from https://github.com/mikespub-org/seblucas-cops/releases/download/2.2.1/cops-2.2.1.zip and tried to use viewer. PHP 8.2.7.

[Wed Jan 24 14:35:44.976454 2024] [php:error] [pid 1091] [client 192.168.1.yyy:58318] PHP Fatal error: Uncaught Error: Call to a member function getDatabaseId() on null in /var/www/html/cops/lib/Output/EPubReader.php:107\nStack trace:\n#0 /var/www/html/cops/epubreader.php(23): SebLucas\Cops\Output\EPubReader::getReader()\n#1 {main}\n thrown in /var/www/html/cops/lib/Output/EPubReader.php on line 107, referer: http://192.168.1.xxx/cops/index.php?page=10&db=2

I used firefox (Brave browser does not work at all, probably Brave issue)

@dunxd
Copy link

dunxd commented Jan 24, 2024 via email

@marioscube
Copy link

marioscube commented Jan 24, 2024

@dunxd

Both issues are related to the monocle viewer.

In my humble opinion monocle should be removed from COPS and/or replaced with a better working epub viewer.

Maybe I will report this issue in the mikespub repository.

@marioscube
Copy link

marioscube commented Jan 24, 2024

@viking-k

What is the output of http://YourLocalIP/cops/checkconfig.php ?

@viking-k
Copy link
Author

viking-k commented Jan 24, 2024

@marioscube

Can you install PHP 8.1 on your synology (not saying you should)?

Unfortunately I am limited to PHP 7.4. This is the newest version of PHP available. So the COPS version available to me is 1.5.4.

With what client are you using COPS (eg. Windows Edge)?

Any (firefox, Chrome, Windows Edge)

Maybe reinstall COPS 1.5.4 ?

I used the https://synocommunity.com/package/cops package. Reinstallation did not yield any results.

What is the output of http://yourlocalip/cops/checkconfig.php ?

Check if PHP version is correct
OK (7.4.30)
Check if GD is properly installed and loaded
OK
Check if Sqlite is properly installed and loaded
OK
Check if libxml is properly installed and loaded
OK
Check if DOM is properly installed and loaded
OK
Check if XMLWriter is properly installed and loaded
OK
Check if Json is properly installed and loaded
OK
Check if mbstring is properly installed and loaded
OK
Check if intl is properly installed and loaded
OK
Check if Normalizer class is properly installed and loaded
OK
Check if zlib is properly installed and loaded
OK
Check if the rendering will be done on client side or server side
Client side rendering
Check if Calibre database path is not an URL
ALL OK
Check if Calibre database file exists and is readable
ALL OK
Check if Calibre database file can be opened with PHP
ALL OK
Check if Calibre database file contains at least some of the needed tables
ALL OK
Check if Calibre database path is not an URL

@viking-k
Copy link
Author

@marioscube @dunxd

I realize my version of COPS is too old, anyway thanks for the help.

@marioscube
Copy link

@viking-k

what you can do is install version 1.5.4 of COPS directly from GitHub.

install in a new directory copsnew
cd copsnew
wget https://github.com/mikespub-org/seblucas-cops/releases/download/1.5.4/cops-1.5.4.zip
Unzip (7z) cops-1.5.4.zip
Copy over the config_local.php

and try again

should work.

@dunxd
Copy link

dunxd commented Jan 24, 2024

Viewing epubs in the Browser works for me using mikespub version 2.2.2 - every epub I've thrown at it works fine. But yes, monocle's readme itself warns that it is no longer maintained. Do you have thoughts for a replacement?

Please do post your thoughts on monocle over there. I'm not sure it is even possible to make updates to this repo.

@viking-k
Copy link
Author

@marioscube
Copy link

@dunxd
mikespub version 2.2.1 (most recent download)

Works only on the first library. on other libraries I get either a white screen or the wrong book.

@marioscube
Copy link

@viking-k

It might be a PHP error. Can you reinstall PHP7.4?

@dunxd
Copy link

dunxd commented Jan 25, 2024

Report any issues with the mikespub fork in that fork's repository were it may be picked up by those working on it - not here or by reply to these messages.

Start a new issue at https://github.com/mikespub-org/seblucas-cops/issues.

@viking-k
Copy link
Author

viking-k commented Feb 5, 2024

comrades, Issues can be closed.

I was able to install the same COPS 1.5.4-9 package on the same version of PHP 7.4 , but on a different synology. No problems with epub viewing. I will now look for the cause in my DSM.

@mikespub
Copy link

@marioscube the error you reported above

[Wed Jan 24 14:35:44.976454 2024] [php:error] [pid 1091] [client 192.168.1.yyy:58318] PHP Fatal error: Uncaught Error: Call to a member function getDatabaseId() on null in /var/www/html/cops/lib/Output/EPubReader.php:107\nStack trace:\n#0 /var/www/html/cops/epubreader.php(23): SebLucas\Cops\Output\EPubReader::getReader()\n#1 {main}\n thrown in /var/www/html/cops/lib/Output/EPubReader.php on line 107, referer: http://192.168.1.xxx/cops/index.php?page=10&db=2

should be fixed in release 2.2.2

This is unrelated to the original issue reported by @viking-k

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants