PHP Errors on dynamically generated CSS and JS file

I recently faced PHP errors on one of the dynamically generated CSS and JavaScript files in Ultimate CMS plugin. I tried the PHP error reporting, but it didn’t work for me.

I used error_reporting('E_NONE'); so that the page won’t show any PHP errors, but due to some warnings or other, the error seems to reappear.

Later i thought may be i could store the initial output in buffer and clean the buffer before using it again, and guess what, It worked.

This is the code i used:

header('Content-type: text/css');
ob_start();
require_once("../../../wp-config.php");
ob_clean();

Leave a Comment

Your email address will not be published. Required fields are marked *