增加PHP内存限制(Apache的,Drupal6) [英] Increase PHP Memory limit (Apache, Drupal6)

查看:198
本文介绍了增加PHP内存限制(Apache的,Drupal6)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图运行一个共享的主机服务器上的Drupal安装。 (我只是订阅供应商 - 我没有自己的箱子)

I'm trying to run a Drupal installation on a shared hosting server. (I'm just subscribing to a provider - I don't own the box.)

我需要增加PHP内存限制我的Apache服务器。我曾尝试

I need to increase the PHP memory limit for my Apache server. I have tried

ini_set('memory_limit', '64M');

在settings.php文件(包含在每个请求的文件),但是这会导致内部服务器错误500。如果我把它拿出来,我得到这个错误:

in settings.php (a file that is included in every request), but this causes Internal Server Error 500. If I take it out, I get this error:

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 19456 bytes)...

侧问题:?19456小于33554432.为什么说,允许大小用尽

Side question: 19456 is less than 33554432. Why is it saying that allowed size is exhausted?

我也试过把这个对的.htaccess:

I also tried putting this in on .htaccess:

 php_value memory_limit 				128M

这是没有效果的。

推荐答案

你所得到的错误消息:

允许的内存大小
  用尽(试图分配19456
  字节)

Allowed memory size of 33554432 bytes exhausted (tried to allocate 19456 bytes)

表示您要分配比你被允许使用的字节数33554432更多;即32 MB:

Indicates that you are trying to allocate more than the 33554432 bytes you are allowed to use ; ie 32 MB :

; 33554432/1024/1024
        32

这表明发生故障的分配是,当PHP tryied分配19千字节;但有已经几乎32MB分配 - 这些分配并没有失败,因为他们的总少于32 MB

It indicates that the allocation that failed was when PHP tryied to allocate 19 Kbytes ; but there had already been almost 32MB allocated -- those allocations did not fail, as their total was less than 32 MB.

错误消息的19456字节的部分是不是有什么真正相关:什么是相关的是,你的 memory_limit的设置为32 MB

The "19456 bytes" part of the error message is not what is really relevant : what is relevant is that your memory_limit is set at 32 MB.

结果
考虑到 memory_limit的是某种形式的安全性,这将是奇怪的是,你的托管服务提供商可以让你改变它的价值...


Considering the memory_limit is some kind of security, it would be strange that your hosting provider allows you to change its value...

如果您使用的是共享主机,这将意味着,在服务器上的任何人都可以得到他们想要的任何内存量......这不会是很好的为同一服务器上的其他用户!

If you are on shared hosting, it would mean that anyone on the server could get any amount of memory they want... Which would not be that nice for the other users on the same server !

BTW:32MB实际上是一个相当合理的价值 - 我从来没有见过配置为允许超过32 MB的web应用程序的服务器......而对于PHP 5.2的默认值似乎是16 MB,根据手动
结果的(我一直在使用Drupal工作了几个月)

BTW : 32MB is actually a quite reasonable value -- I've never seen a server configured to allow more than 32 MB for a web application... And the default value for PHP 5.2 seems to be 16 MB, according to the manual.
(And I've been working with Drupal for a couple of months)

结果
有关错误500,我没有很多的想法......一种可能性是,该的 safe_mode设置 被激活,而且它不允许在执行时设置memory_limit的。


About the error 500, I don't have a lot of ideas... One possibility might be that the safe_mode is activated, and that it doesn't allow setting the memory_limit at execution time.

本手册不看多讲了,但下一个位的信息<一个href=\"http://php.net/manual/en/info.configuration.php#ini.max-execution-time\"><$c$c>max_execution_time指令:

The manual doesn't see to say much about that, but there is a bit of information under the max_execution_time directive :

您不能更改此设置
  的ini_set()在安全模式下运行时
  唯一的解决方法是关闭
  安全模式或通过改变时间
  限制在php.ini。

You can not change this setting with ini_set() when running in safe mode. The only workaround is to turn off safe mode or by changing the time limit in the php.ini.

我想同样是关于 memory_limit的真实的;这似乎合乎逻辑,无论如何。

I suppose the same is true about memory_limit ; it would seem logical, anyway.

这篇关于增加PHP内存限制(Apache的,Drupal6)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆