Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sometimes after activating a plugin the admin side is blank with a memory error message, sometimes the front page too. The standard fix is to increase the memory in config.php.

What is the best way to prevent in advance all or most memory problems to occur ?

share|improve this question
add comment

2 Answers 2

up vote 2 down vote accepted

Using FTP, try increasing the memory for PHP and Wordpress by editing the memory_limit line in your php.ini (if you have access to it) to 64M or 128M, which should be fine for non-multisite installs.

memory_limit = 64M;

If you can't get to the php.ini file, add this line at the top of your .htaccess file:

php_value memory_limit 64M

If that doesn't work or throws an error, add this line near the top of your wp-config.php file right after the opening <?php

define('WP_MEMORY_LIMIT', '64M');

But your host may limit changes to .htaccess in your account and to the host-wide php.ini, so these may not work. if not, ask your host.

You can run phpinfo to see what kind of memory allocation you already have. Make a plain text file and call it phpinfo.php and put just this line in it:

<?php phpinfo(); ?>

then put the file in the root of your server, and then go to that file with your web browser. You'l see all the php info you need; scroll down for memory settings. If you get an error, that means your server company won't allow phpinfo to run for security reasons.

share|improve this answer
    
Why 64 rather than 256 or 512 as suggest above ? –  Mike Jul 12 '11 at 10:36
1  
64 is plenty; you're not going to have 256 or 512 available on a shared host (and that will result in more errors), and you don't need that much unless you're running multisite and on a VPS. If you can't get WP to run OK bumping to 64M at your host, ask them; you may need to think about changing hosts. –  songdogtech Jul 12 '11 at 13:26
add comment

It can be set it your .htaccess file:

php_value memory_limit 16M

Set it to 256M or 512M and you should be ok.

share|improve this answer
    
Uh every time I tried to add this line to my .htaccess I couldn't access any page is it normal ? O_o –  Mike Jul 9 '11 at 22:01
    
Depends on your hosts config. Can you access error logs? –  Alex Older Jul 10 '11 at 16:10
    
64 is plenty; you're not going to have 256 or 512 available on a shared host (and that will result in more errors), and you don't need that much unless you're running multisite and on a VPS. –  songdogtech Jul 12 '11 at 13:27
    
All right thanks ! –  Mike Jul 13 '11 at 8:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.