升级WordPress 2.8.6 到 2.9

网站刚建,正在配置优化,看到最新版的2.9,是一个较重要的版本升级,于是决定先升级再配置、优化。在后台自动升级,不成功,出现以下错误提示:

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2764934 bytes) in /home5/ninoneum/public_html/ee-forum.org/wp/wp-includes/http.php on line 1331

搜索结果很多,就不引用了,得知这是php或wp设置参数问题,建议无非三条:

  1. 修改php.ini                            memory_limit = xxM
  2. 在程序里面添加                     ini_set(‘memory_limit’, ‘xxM’);
    对wp,wp-settings.php 中有设定(在某个版本开始我没求证)
  3. 在根目录.htaccess 添加     php_value memory_limit xxM

具体数值应该比现有限制加一倍,例如 32M(33554432) -> 64M

据说修改了php.ini,可能要重启服务器。后面的方法,则可能受到服务器设置的限制,不一定生效。我使用的是Bluehost服务器,但我无法修改php.ini,想着没事最好不要去找服务商,于是找到 wp-settings.php 先试试运气。一找就找到了:

if ( !defined(‘WP_MEMORY_LIMIT’) )
define(‘WP_MEMORY_LIMIT’, ’32M’);

if ( function_exists(‘memory_get_usage’) && ( (int) @ini_get(‘memory_limit’) < abs(intval(WP_MEMORY_LIMIT)) ) )
@ini_set(‘memory_limit’, WP_MEMORY_LIMIT);

将上面的数字32M改为64,再回到后台执行升级,OK

今天股票也涨了,运气不错滴说;-)

—-

顺便保留一个帖子,作为备忘。这里解释了在Bluehost上修改php.ini无需重启的特点,和一些操作的注意事项。

Bluehost Clarification

Maximus284 – December 18, 2008 – 09:17

I am one of the tech support staff for the bluehost companies and i would like to clarify a few settings on our system.

Your PHP.INI file is the file you need to modify in order to increase your memory limit.

the settings you will need to modify are these:

max_execution_time = 30 ; Maximum execution time of each script, in seconds (set this to something high like 300)

max_input_time = 60 ; Maximum amount of time each script may spend parsing request data (set this to something high like 600)

memory_limit = 10M ; Maximum amount of memory a script may consume (set this to something like 500M)

Then in the php config icon of your account, set your site to the php5 (single php.ini) settings as the Fast CGI is not compatible with some drupal installations. if you find that fast cgi works, great if not, just stay on the php 5 setting.

Also, you do Not need to , and you cannot reboot the server on bluehost. We have a special modification to our server that allows the php.ini files to be initialized on the fly and it does not need to be restarted every time a change is made. Therefore, make the changes in the php.ini and refresh your site a couple of times and the new settings will be applied.

To see if the settings you are making in your account are taking affect, put a phpinfo.php file in your account and use the <? phpinfo(); ?>

Lastly, do not use the php_flag variable in our server. The .htaccess file does not recognize that flag and it will result in your account producing a 500 error, just make your modifications to the php.ini file itself.

If the above memory fix does not solve your problem, there may be a file in the drupal that is limiting your memory usage. (as this line suggests here: “ini_set(‘memory_limit’, ’12M’); in your sites/default/settings.php file”)

If all the above doesn’t work, contact the bluehost support and drupal to see if there are any other fixes to your problem and/or any other files you may need to modify.

Thanks

—-

一条回应 to “升级WordPress 2.8.6 到 2.9”

  1. Robert Poehler Says:

    As I see bluehost provides an individual and very professional service. It would be great if every provider would work like that.


留下评论