-
AuthorPosts
-
March 13, 2024 at 10:53 am #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,
ElMarch 14, 2024 at 7:23 am #1437199Hey 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,
IsmaelMarch 14, 2024 at 4:11 pm #1437231Ismael,
we already run this code since it is of no use for us. I think this is something else.
Best,
ElMarch 18, 2024 at 11:55 am #1437461Hi,
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,
IsmaelMarch 18, 2024 at 12:19 pm #1437467Hey 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,
ElMarch 18, 2024 at 12:29 pm #1437469Oh, 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,
ElMarch 18, 2024 at 2:22 pm #1437480Hi,
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ünterMarch 18, 2024 at 3:07 pm #1437485Got 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_rocketMarch 20, 2024 at 5:15 am #1437669 -
AuthorPosts
- The topic ‘Minify kills PHP service’ is closed to new replies.