Umkhawulo wememori ku-WordPress

tl; dr: Setha ngokuzenzela inani noma amanani azenzakalelayo we WP_MEMORY_LIMIT/WP_MAX_MEMORY_LIMIT zingabi namphumela uma WP_MEMORY_LIMIT/WP_MAX_MEMORY_LIMIT ngaphansi noma okulingana nomkhawulo wememori we-PHP (ngemuva kwalokhu memory_limit ebizwa) yi. Asetshenziselwa ukusetha amanani aphansi kakhulu we memory_limit ngokushintshashintshayo ukuya kokuncane okunconyiwe.


  • Njalo WP_MEMORY_LIMIT ingangena ngokuzikhethela wp-config.php nge define('WP_MEMORY_LIMIT', 'XXXM'); zibekwe.
  • Njalo WP_MAX_MEMORY_LIMIT ingangena ngokuzikhethela wp-config.php nge define('WP_MAX_MEMORY_LIMIT', 'XXXM'); zibekwe.
  • Kuyinto WP_MEMORY_LIMIT ingasethiwe, isebenza enalulweni layo elimisiwe:
    • memory_limit, inikeze inani le memory_limit ayikwazi ukushintshwa ngamandla,
    • 64 MB uma kuyi-multisite,
    • 40MB uma kungenjalo.
  • Kuyinto WP_MAX_MEMORY_LIMIT ingasethiwe, isebenza enalulweni layo elimisiwe:
    • memory_limit, inikeze inani le memory_limit ayishintsheki ngokushintshashintshayo noma uma ingenamkhawulo (-1) noma inkulu kuno noma ilingana no-256 MB,
    • 256 MB ngenye indlela .
  • Amanani azenzakalelayo aye aphakanyiswa kaningi esikhathini esidlule.
  • WP_MEMORY_LIMIT ishintshwe yonke indawo kusetshenziswa umsebenzi ini_set() ashukumisayo memory_limit, uma WP_MEMORY_LIMIT enkulu kunale yamanje memory_limit noma nini WP_MEMORY_LIMIT ayinamkhawulo (-1).
  • WP_MAX_MEMORY_LIMIT ishintshiwe ku-backend (ngokunembile kakhulu: noma nini lapho umsebenzi wp_raise_memory_limit() ebizwa ngezimo ezahlukahlukene [admin, image]) kusetshenziswa umsebenzi ini_set() ashukumisayo memory_limit, uma WP_MAX_MEMORY_LIMIT enkulu kunale yamanje memory_limit noma nini WP_MAX_MEMORY_LIMIT ayinamkhawulo (-1).
  • Umqondo we WP_MAX_MEMORY_LIMIT uyagijima ngemva logic ye WP_MEMORY_LIMIT, ukuze WP_MEMORY_LIMIT ngaphambili futhi WP_MAX_MEMORY_LIMIT iqala ukusebenza ngemuva.
  • Okuningi kokunengqondo okuchazwe ngenhla kuyasebenza wp_initial_constants() (/wp-includes/default-constants.php) njengoba ku wp_raise_memory_limit() (/wp-includes/functions.php) esikhundleni se.
  • Inani memory_limit = XXXM phakathi php.ini Zichazwa memory_limit (ngemuva kokuqalisa kabusha isevisi yewebhu).
  • Inani php_value memory_limit XXXM phakathi .htaccess Zichazwa memory_limit kuwo wonke amafayela we-PHP kufolda noma ifolda yayo engaphansi lapho i- .htaccess itholakala.
  • Iseva yewebhu ingavimbela inani lomkhawulo wenkumbulo ukuthi lingashintshwa nge- ini_set() noma lingeqe inani elishiwo (bona php_admin_value ).
  • memory_limit kusebenza ngenqubo ngayinye: Ukunyuka kwe memory_limit kungaba bangela ukuba inani lezicelo ze-PHP ezifanayo lehle. Ngakho-ke inani kufanele likhethwe ngokucophelela (256 MB, ezimweni ezingavamile 512 MB).
  • Ku-backend ye-WordPress ngaphansi Amathuluzi> Isimo Sewebhusayithi, amanani we memory_limit (Isigaba: Iseva), kanye nokusuka WP_MEMORY_LIMIT futhi WP_MAX_MEMORY_LIMIT (isigaba se-WordPress constants) singafundwa.
Emuva