qtranslate / qtranslate-xt

qTranslate-XT (eXTended) - reviving qTranslate-X multilingual plugin for WordPress. A new community-driven plugin soon. Built-in modules for WooCommerce, ACF, slugs and others.
GNU General Public License v2.0
545 stars 103 forks source link

Ask: fatal error allowed memory size in wp-content/object-cache.php #1397

Open brm-ryd opened 4 months ago

brm-ryd commented 4 months ago

Hi,

sorry i have an issue when tried to upgrade to latest qtranslate-xt (from 3.12.1 to 3.15.2) with error:

in php7.4:
PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 bytes) in /var/www/html/wp-content/object-cache.php on line 193             
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 bytes) in /var/www/html/wp-content/object-cache.php on line 193                  
PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 bytes) in /var/www/html/wp-includes/load.php on line 326                    
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 bytes) in /var/www/html/wp-includes/load.php on line 326

in php8.1 (increase memory limit to 512M)
PHP Fatal error:  Allowed memory size of 536870912 bytes exhausted (tried to allocate 262144 bytes) in /var/www/html/wp-content/object-cache.php on line 193
Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 262144 bytes) in /var/www/html/wp-content/object-cache.php on line 193

PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 bytes) in /var/www/html/wp-content/object-cache.php on line 2558
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 bytes) in /var/www/html/wp-content/object-cache.php on line 2558 

does my issue similar with this previously issue https://github.com/qtranslate/qtranslate-xt/issues/1286 and am i need to allocate up to 2GB+ for this as the current server i only get 3GB ram though.

Many thanks & appreciate for any thoughts

Komarovski commented 4 months ago

I'll try to help, Can you tell what value you have for "php_memory_limit" in your server's php.ini file or if you doesn't have access to this file, check in hosting panel for memory limit.

Check .htaccess file for string "php_value memory_limit" - if you have one, what you have there?

Also check wp-config.php file for "WP_MEMORY_LIMIT" and "WP_MAX_MEMORY_LIMIT". If you have this constants - what values you have there?

If you have one website on server, I recommend increase memory limit to the max. For example if you have 3GB of RAM I recommend to set "php_memory_limit" value in php.ini or in hosting panel to 3072M. If in .htaccess file you have string "php_value memory_limit" set value to 3072M. If in wp-config.php file you have defined "WP_MEMORY_LIMIT" and "WP_MAX_MEMORY_LIMIT". For "WP_MEMORY_LIMIT" set value to 1024M and for "WP_MAX_MEMORY_LIMIT" set value to 3072M.

If you're using OPcache - I recommend to set available memory for OPcache to use in range of 96-128 MB. If you're using Redis object cache - I recommend to set available memory for Redis to use between 30-35% of all available memory. In case you have 3GB RAM for Redis cache set available memory value to 1024M. If you're using Memcache object cache - I recommend to set available memory for Memcache to use 1024M | 2048M.

brm-ryd commented 4 months ago

Thank you @Komarovski , AFAIK, the memory_limit only set in php.ini which tried to set 256M & 512M, for wp-config.php & .htaccess there should be exist any memory_limit or anything.

Redis object cache is exist do you think testing for disable the plugin to check for redis config i believe the memory is also around 256M & 512M.

Komarovski commented 4 months ago

The memory_limit with 256M or 512M for WordPress is too low, especially if you have a lot of plugins, custom queries, not optimized theme, etc. If your hosting plan gives you 3GB of RAM, then set in php.ini memory_limit to 3072M. This way PHP will have enough of RAM if it will need to process some heavy script.

In this log:

in php8.1 (increase memory limit to 512M)
PHP Fatal error:  Allowed memory size of 536870912 bytes exhausted (tried to allocate 262144 bytes)...

PHP is telling you that you have allowed memory of 536870912 bytes (approx. 536 MB). And "tried to allocate 262144 bytes" telling that your script need approx. 262 KB more of RAM to process the script.

As for Redis, if you already have set in php.ini memory_limit to 3072M, then in Redis configuration file I recommend to set maxmemory 1gb - this will be optimal.

valerensi commented 3 months ago

Hello, I also have the same problem both with version 3.15.1 and 3.15.2 Fatal error: Allowed memory size of 805306368 bytes exhausted (tried to allocate 16777224 bytes)