Turinys
"WordPress" atminties išnaudojimo klaida atsiranda, kai scenarijus viršija numatytąją PHP atminties paskirstymo ribą. Tai gali trukdyti jūsų svetainei tinkamai veikti ir sukelti tokį klaidos pranešimą: "Fatal error: X baitų leistinas atminties dydis išnaudotas." Padidinus PHP atminties limitą, ši problema dažnai išsprendžiama. Štai kaip tai padaryti: [...]
Redaguoti wp-config.php failą
Svetainė wp-config.php
file contains the base configuration details for your WordPress site. You can increase the PHP memory limit by adding a line of code to this file.
- Connect to your website using an FTP client or the file manager provided in your hosting control panel.
- Raskite
wp-config.php
file which is in the root directory of your WordPress installation. - Edit the file and add the following line of code just before the line that says
/* That's all, stop editing! Happy blogging. */
:
define('WP_MEMORY_LIMIT', '256M');
This line increases the PHP memory limit to 256MB. You can adjust the value based on your needs and the capabilities of your hosting environment.
- Save your changes and upload the file back to your server if you’re using FTP.
Redaguokite PHP.ini failą
If editing the wp-config.php
doesn’t resolve the issue, you might need to increase the limit in the php.ini
file, which is the default configuration file for PHP.
- This file is usually not accessible on shared hosting, but you can create a file named
php.ini
in the root directory of your WordPress installation and add the following line:
memory_limit = 256M
- If you’re on a VPS or dedicated server and have access to the main
php.ini
file, you can directly edit this file with the same line. The location of this file can vary depending on your server configuration.
Redaguokite .htaccess failą
Another way to increase the PHP memory limit is by editing the .htaccess
file located in the root directory of your WordPress installation.
- Access your site via FTP or file manager, and find the
.htaccess
failas. - Edit the file and add the following line:
php_value memory_limit 256M
- Save your changes and check if the memory exhausted error is resolved.
Susisiekite su prieglobos paslaugų teikėju
If none of the above solutions work, your hosting provider may not allow manual increases to the PHP memory limit. Contact their support team for assistance. They can either increase the limit for you or provide guidance on how to do it within their hosting environment.
Išvada
Increasing the PHP memory limit can help resolve the memory exhausted error in WordPress. However, it’s also important to understand why the error occurred. It could be due to a poorly coded plugin, theme, or custom script. Consider deactivating plugins and switching to a default WordPress theme temporarily to diagnose the issue. If the problem persists, you may need to optimize your website or upgrade your hosting plan to accommodate your site’s requirements.