Giter Club home page Giter Club logo

Comments (3)

YID-C avatar YID-C commented on May 26, 2024

I also tried investigating the "Cpdf.php" file the error log was pointing to. I made my way to the specific line thinking there may be another setting equivelant to "set_max_timeout" that could be changed but unfortunately that doesn't seem to be the case. This section appears to be about styling.
I did read in one of the other posts someone asked about fonts, but I only have the standard fonts that come with Ubuntu and haven't made any changes.
From the error log it seems it always terminates around line 5748, which I take to mean that is about as far as the process is able to get before the 30 second timer runs out and it is forced to terminate. It seems to me if it respected the extended time limit it would complete as it is near the end already. It appears to be functioning but just keeps getting killed before it can complete.
I may need to resubmit this as a bug?

See this screenshot of Cpdf.php with the cursor at line 5,748:
Screenshot_4455

from bookstack.

YID-C avatar YID-C commented on May 26, 2024

I SOLVED IT!

So as it turns out, there are multiple php.ini files. I was editing the php.ini file located in:
/etc/php/8.1/cli/php.ini

However the standard install of BookStack, at least for me, is Apache, which has it's own copy. So to solve the issue, I had to go into:
/etc/php/8.1/apache2/php.ini

Once I edited the php.ini file in the apache2 folder and restarted, it worked. When clicking on "export" and then ".pdf file", BookStack will open a new blank tab and it will hang there. In my instance, my book with several hundred pages and easily as many images took just over two minutes to complete, well beyond the default 30 second limit. Once it's complete it downloads via your browser. In my instance I've yet to setup HTTPS so I received a warning that it was insecure, but since I know where it's coming from I accepted and the .pdf downloaded and displays as normal.

Here's some troubleshooting steps for anyone else who receives either the "unknown error" or "maximum execution time of 30 seconds exceeded" when trying to export in future:

  1. You need to know or find out what web server you're running as this will determine where the .php.ini file is. If you're having trouble getting the full name exactly correct, make sure you have installed ubuntu with the graphical user interface, click "files" from the desktop, click "other locations" and then "computer". This will get you to the very top of your directory or the equivalent of C: in windows. I don't know why Linux doesn't bring you here by default.
    Screenshot_4457

  2. Once you're at the top of your directory, you can navigate/drill down and explore. First check /etc/php/((YOUR_VERSION))/ and theoretically your webserver should have a folder in here.
    Screenshot_4458

  3. Now that you have the name for your web servers folder, open a terminal and navigate to it using the cd command. For this command I'll use apache2 as that seems to be the current default for Ubuntu, but replace "apache2" with the folder for your web server if necessary. I'm also running php 8.1 but replace as necessary for your version. Your command should look like
    cd /etc/php/((YOUR_PHP_VERSION))/((YOUR_WEB_SERVER))
    In my case
    cd /etc/php/8.1/apache2

  4. This should have changed your terminal so you see /etc/php/8.1/apache2 to the left of your cursor. From here we'll use Linuxs' built in command line text editor (nano) to edit the file. We're also going to need to run this with super user/root permissions or we won't be able to save the file so you'll need an administrator password. Run this command:
    sudo nano php.ini

  5. Enter your admin/root/account password and it should open a colourful window. From here we want to scroll all the way down using the arrow keys until we bump into RESOURCE LIMITS. Just below this you should see the line "max_execution_time = 30". We want to increase this. I set mine to 3000 which is 50 minutes but you set it to whatever you like.

  6. Next, a few more lines down you should see "memory limit = 128M". You'll want to increase this as well, how much depends on how many resources your server has available. I provisioned (built) my server with 8GB of RAM so I just quadrupled the amount to 512 megabytes. You'll want the values to look like this:
    Screenshot_4456

  7. Once the values have been updated, you need to press "CTRL + X" to exit. You'll be asked if you want to save. Press "y". You'll then be asked what you want to name the file. It should be autofilled with "php.ini" already so just hit enter. If you have sufficient permissions, that should be it and you'll be back at the command line. Otherwise you'll receive an error stating you don't have permission.

  8. Once this is done, restart your server. I just restarted ubuntu completely and it worked. If you can't or don't want to restart the server there are ways to restart webservers via the command line. In my case with apache, I used the command:
    /etc/init.d/apache2 restart

  9. Once your server is back up, go back to your BookStack instance and try the export again. Remember it will give you a blank page and probably sit there for a long time but just let it do it's thing.

Hopefully that's helped you out. Good luck!

from bookstack.

ssddanbrown avatar ssddanbrown commented on May 26, 2024

Happy to hear you found the solution to your issue @YID-C, and thanks for sharing your resolution steps.
I'll therefore close this off.

from bookstack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.