PHP error occurring during mPDF export. Help?

For one text book, the export process begins fine, then fails part way through. The PHP logs show the following error getting recorded:

PHP Fatal error: Maximum execution time of 600 seconds exceeded in /data/pressbooks/htdocs/wp-content/plugins/pressbooks-mpdf/symbionts/mpdf/mpdf.php on line 10750

And here’s the corresponding line of code from mpdf.php, lines 10747-10755:

10747          // extract alpha channel
10748          for ($ypx = 0; $ypx < $h; ++$ypx) {
10749             for ($xpx = 0; $xpx < $w; ++$xpx) {
10750                $alpha = (imagecolorat($im, $xpx, $ypx) & 0x7F000000) >> 24;
10751                if ($alpha < 127) {
10752                   imagesetpixel($imgalpha, $xpx, $ypx, (255-($alpha * 2)));
10753                }
10754             }
10755          }

I am aiming to explain how it is the php-errors.log file continues to show the “maximum execution time of 600 seconds exceeded” when I am able to point to all the following config settings I have been sure to revise with higher values for timeouts.

php.ini

max_execution_time = 2000

wp-config.php

set_time_limit(2000);

.htaccess

<IfModule mod_php5.c>
 php_value max_execution_time 2000
</IfModule>

So, the number “600” doesn’t correlate. In addition, I have downloaded php source files to do global searching for any place a value of “600” is set for a timeout variable (of any kind) and I’m unable to track it down.


If it helps, here is the diagnostic info straight out of PressBooks:

### System Information
 
#### Book Info
 
Book ID: 3
Book URL: http://library.open.oregonstate.edu/computationalbiology/
Book Privacy: Public
 
#### Browser
 
Platform: Apple
Browser Name: Firefox
Browser Version: 51.0
User Agent String: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:51.0) Gecko/20100101 Firefox/51.0
 
#### WordPress Configuration
 
Network URL: http://library.open.oregonstate.edu/
Network Type: Subdirectory
Version: 4.7.1
Language: en_US
WP_ENV: Not set
WP_DEBUG: Disabled
Memory Limit: 64M
 
#### Pressbooks Configuration
 
Version: 3.9.6
Book Theme: Pressbooks Custom CSS
Book Theme Version: 0.1
Root Theme: Pressbooks Publisher
Root Theme Version: 3.0.1
 
#### Pressbooks Dependencies
 
Epubcheck: Not Installed
Kindlegen: Installed
xmllint: Installed
PrinceXML: Not Installed
Saxon-HE: Not Installed
 
#### Must-Use Plugins
 
 
#### Network Active Plugins
 
CM Tooltip Glossary: 3.4.4
Pressbooks: 3.9.6
Pressbooks mPDF: 1.0.1
Pressbooks Textbook: 3.0.1
SSH SFTP Updater Support: 0.7.1
Table of Contents Plus: 1601
WP Broken Link Status Checker: 1.0.4
WP QuickLaTeX: 3.8.4
 
#### Book Active Plugins
 
 
#### Inactive Plugins
 
Akismet: 3.2
 
#### Server Configuration
 
PHP Version: 5.4.16
MySQL Version: 5.5.52
Webserver Info: Apache/2.4.6 (CentOS) PHP/5.4.16
 
#### PHP Configuration
 
Safe Mode: Disabled
Memory Limit: 1024M
Upload Max Size: 99M
Post Max Size: 99M
Upload Max Filesize: 99M
Time Limit: 2000
Max Input Vars: 1000
URL-aware fopen: On (1)
Display Errors: N/A
 
#### PHP Extensions
 
cURL: Supported
cURL Version: 7.29.0
imagick: Not Installed
sass: Not Installed
xsl: Installed

This is a puzzling one. I will defer to @brad, who is the expert in all things mPDF.

1 Like

sure thing — we can move this issue over to https://github.com/bccampus/pressbooks-mpdf/issues for further digging in

1 Like

I’ll add it as a new issue, then. Glad to do the legwork on that.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.

To resolve this issue, I updated the set_time_limit( ) instances explicitly set in the following files:

mpdf/utils/font_coverage.php line 19
mpdf/utils/font_dump.php line 27
pressbooks/includes/modules/export/mpdf/class-pb-pdf.php line 110*

*the mPDF export failed to complete until the timeout was increased on this last php file.

Fixed in https://github.com/pressbooks/pressbooks/pull/652.