Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1437121

    Hey there,

    we geht an error that is triggered by the Enfold minify script process:

    AH01071: Got error ‘PHP message: PHP Fatal error: Uncaught ValueError: fread(): Argument #2 ($length) must be greater than 0 in /var/www/vhosts/aerobis.com/httpdocs/wp-content/themes/enfold/framework/php/function-set-avia-backend.php:1146\nStack trace:\n#0 /var/www/vhosts/aerobis.com/httpdocs/wp-content/themes/enfold/framework/php/function-set-avia-backend.php(1146): fread()\n#1 /var/www/vhosts/aerobis.com/httpdocs/wp-content/themes/enfold/config-templatebuilder/avia-template-builder/php/class-asset-manager.php(810): avia_backend_create_file()\n#2 /var/www/vhosts/aerobis.com/httpdocs/wp-content/themes/enfold/config-templatebuilder/avia-template-builder/php/class-asset-manager.php(358): aviaAssetManager->generate_file()\n#3 /var/www/vhosts/aerobis.com/httpdocs/wp-content/themes/enfold/config-templatebuilder/avia-template-builder/php/class-asset-manager.php(243): aviaAssetManager->merge()\n#4 /var/www/vhosts/aerobis.com/httpdocs/wp-includes/class-wp-hook.php(324): aviaAssetManager->try_minifying_scripts()\n#5 /var/www/vhosts/aerobis…’

    This happens (or at least affects us) since the provider updated to the latest recommended Woocommerce / WordPress versions of MySQL and PHP.

    Best,
    El

    #1437199

    Hey El,

    Thank you for the inquiry.

    Do you get error when the Enfold > Performance > File Compression settings are disabled? The error seems to be generated when the theme attempts to generate the dynamic css for posts.

    You can also add this code in the functions.php file to temporarily disable the dynamic css files for posts.

    /**
     * Filter to skip css file generation.
     * You can add logic to skip for certain pages/posts only.
     * 
     * @since 4.8.6.1
     * @param boolean $create
     * @return boolean					true | false or anything else to skip generation of css file
     */
    function custom_avf_post_css_create_file( $create )
    {
    	return false;
    }
    
    add_filter( 'avf_post_css_create_file', 'custom_avf_post_css_create_file', 10, 1 );

    Best regards,
    Ismael

    #1437231

    Ismael,

    we already run this code since it is of no use for us. I think this is something else.

    Best,
    El

    #1437461

    Hi,

    Thank you for the update.

    The error is generated from the avia_backend_create_file function within the enfold/framework/php/function-set-avia-backend.php. The function is triggered when the theme has to generate the minified and compressed files. Is the issue occurring when the Enfold > Performance > File Compression settings are disabled?

    To temporarily fix the issue, please look for the avia_backend_create_file function and replace it with:

    function avia_backend_create_file( $file, $content = '', $verifycontent = true )
    {
        $handle = @fopen( $file, 'w' );
        if( $handle )
        {
            $created = fwrite( $handle, $content );
            fclose( $handle );
    
            if( $verifycontent === true )
            {
                $handle = fopen( $file, 'r' );
                $fileSize = filesize( $file );
    
                if ($fileSize > 0) {
                    $filecontent = fread( $handle, $fileSize );
                    $created = ( $filecontent == $content ) ? true : false;
                } else {
                    $created = false; 
                }
    
                fclose( $handle );
            }
        }
        else
        {
            $created  = false;
        }
    
        return $created;
    }
    

    Best regards,
    Ismael

    #1437467

    Hey Ismael,

    nope – if I switch it off it is gone. Will this fix go into the next release and if so when will you release it?

    Thanks,
    El

    #1437469

    Oh, btw – I can never actually use the Javascript merge & compress since it will always result in Frontend Javascript errors (we use WP-Rocket). Just wanted to let you know that there seems to be some kind of timing issue when the JS is merged.

    Best,
    El

    #1437480

    Hi,

    Thank you for reporting this problem.

    I completly modified the error handling in function avia_backend_create_file() for next release.

    But in my opinion using WP-Rocket and our file merging does not make much sense. WP-Rocket is as far as I know optimized to handle caching and also minifying.

    You can use our minimized css and js files without merging if you like.

    Best regards,
    Günter

    #1437485

    Got it. I disabled it and just use the compressed files. WP-Rocket Javascript merging is also switched off since it is not recommended for http/2 anymore:
    https://docs.wp-rocket.me/article/1009-configuration-for-http-2?utm_source=wp_plugin&utm_medium=wp_rocket

    #1437669

    Hi,

    Alright! Please feel free to open another thread if you encounter more issues in the future. We’ll close the thread for now.

    Have a nice day.

    Best regards,
    Ismael

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Minify kills PHP service’ is closed to new replies.