• It seems like your plugin doesn’t pass a directory path correctly to DOMPDF library.
    Using CDN and S3 plugin: https://github.com/humanmade/S3-Uploads you get a fatal error from your plugin:

    WARNING: [pool www] child 12877 said into stderr: “NOTICE: PHP message: PHP Fatal error: require(): Failed opening required ‘s3://fl-rapalloav-media/uploads/wpo_wcpdf/fonts/dompdf_font_family_cache.php’ (include_path=’.:/usr/local/lib/php’) in /var/www/htdocs/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/FontMetrics.php on line 140”

    Could you please have a look at it and fix and ideally tell us in the meantime what’s the workaround?

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    Hi! Our plugin uses a local path to store temporary files, but the S3 plugin from Human Made appears to be rerouting all requests (even to that of the server paths, not just the URLs) to the S3 site. This is problematice because PHP files can’t be loaded that way.

    I don’t use S3 myself so I can’t test this, but could you try the following filter as a temporary workaround?

    
    add_filter( 'wpo_wcpdf_tmp_path', function( $tmp_base ) {
    	if ( class_exists('S3_Uploads') && is_callable( array( 'S3_Uploads','get_instance' ) ) ) {
    		// unregister S3 path override filters
    		S3_Uploads::get_instance()->tear_down();
    		// get unfiltered path
    		$upload_dir = wp_upload_dir();
    		if (!empty($upload_dir['error'])) {
    			$tmp_base = false;
    		} else {
    			$upload_base = trailingslashit( $upload_dir['basedir'] );
    			$tmp_base = $upload_base . 'wpo_wcpdf/';
    		}
    		// reboot S3 filters
    		S3_Uploads::get_instance()->setup();
    	}
    	return $tmp_base;
    } );
    
    

    If you haven’t worked with code snippets (actions/filters) or functions.php before, read this guide: How to use filters

    Let us know if that works for you!

    Ewout

Viewing 1 replies (of 1 total)
  • The topic ‘CDN S3 conflict’ is closed to new replies.