Dependencies check creating Fatal Error on admin side

Hi, I’ve been getting this fatal error when logging into the admin of individual books (network OK).

Fatal error: Uncaught Error: Call to undefined function Pressbooks\Utility\exec() in /home/wcclibra/public_html/wp-content/plugins/pressbooks/inc/utility/namespace.php:298 Stack trace: #0 /home/wcclibra/public_html/wp-content/plugins/pressbooks/inc/modules/export/epub/class-epub.php(2843): Pressbooks\Utility\check_epubcheck_install() #1 /home/wcclibra/public_html/wp-content/plugins/pressbooks/inc/modules/themeoptions/class-admin.php(73): Pressbooks\Modules\Export\Epub\Epub::hasDependencies() #2 /home/wcclibra/public_html/wp-content/plugins/pressbooks/inc/modules/themeoptions/class-admin.php(110): Pressbooks\Modules\ThemeOptions\Admin->getTabs() #3 /home/wcclibra/public_html/wp-includes/class-wp-hook.php(341): Pressbooks\Modules\ThemeOptions\Admin->loadTabs('') #4 /home/wcclibra/public_html/wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters(NULL, Array) #5 /home/wcclibra/public_html/wp-includes/plugin.php(522): WP_Hook->do_action(Array) #6 /home/wcclibra/public_html/wp-admin/admin.php(180): do_action('admin_init') #7 /home/wcclibra/public_html/wp-admin/index.php(10): require_once('/home/wcclibra/...') #8 {main} thrown in /home/wcclibra/public_html/wp-content/plugins/pressbooks/inc/utility/namespace.php on line 298

I’ve got some code to create a MU plugin to bypass epub & Prince validation

<?php
/**
 * Disable Pressbooks CLI dependency checks on shared hosting
 * Prevents fatal errors when exec() is disabled
 */

namespace {

	// Short-circuit all Pressbooks dependency checks that rely on exec()
	add_filter( 'pb_prince_dependencies_installed', '__return_false', 1 );
	add_filter( 'pb_epubcheck_dependencies_installed', '__return_false', 1 );

	// Defensive: hide formats that would trigger dependency checks
	add_filter( 'pb_export_formats', function ( $formats ) {

		// Remove Prince / DocRaptor
		unset(
			$formats['standard']['docraptor'],
			$formats['standard']['docraptor_print'],
			$formats['standard']['pdf'],
			$formats['standard']['print_pdf']
		);

		return $formats;
	}, 1 );

}

I still cannot get past this fatal error. How do I fix this or jettison those dependency checks altogether (on a shared host so will never have server root).

Hi Rowena,

Thanks for sharing the error details. The fatal error is occurring because Pressbooks is trying to call PHP’s exec function, which appears to be disabled on your server. Before we work around this, could you check if it is or can be enabled on your server?

  1. Check your php.ini file (or ask your hosting provider) to see if exec is listed in disable_functions

  2. If you have access, try removing exec from that list and restarting your web server

  3. If you don’t have access to modify this, try contacting your hosting provider to ask if they can enable exec for your account

Pressbooks needs exec to check for export dependencies like EPUBCheck and Prince. While we can work around this limitation, the simplest solution would be to enable the function if your hosting allows it.

Pressbooks does not currently provide the hooks you attempted to use. If enabling exec is not an option, then we would need to implement some means to bypass these checks.

Best regards,