无法在共享 PHP 主机上的 Apache 日志中分配内存

无法在共享 PHP 主机上的 Apache 日志中分配内存

我在共享 php 主机上有一个网站。它有时没有响应。有什么可以帮我找到占用所有内存的问题吗?

记录Apache:

[Sun Jul  7 13:08:23 2013] [error] (12)Cannot allocate memory: fork: Unable to fork new process
[Mon Jul  8 00:05:24 2013] [notice] SIGUSR1 received.  Doing graceful restart
[Mon Jul  8 00:05:24 2013] [error] VirtualHost 10.1.226.100:0 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results
[Mon Jul  8 00:05:24 2013] [notice] Apache/1.3.42 (Unix) PHP/5.3.13 mod_gzip/1.3.26.1a configured -- resuming normal operations
[Mon Jul  8 00:05:24 2013] [notice] Accept mutex: flock (Default: flock)
[Mon Jul  8 10:19:16 2013] [error] (12)Cannot allocate memory: fork: Unable to fork new process
[Mon Jul  8 10:19:26 2013] [error] (12)Cannot allocate memory: fork: Unable to fork new process
[Mon Jul  8 11:52:20 2013] [error] (12)Cannot allocate memory: fork: Unable to fork new process
[Mon Jul  8 13:40:52 2013] [error] (12)Cannot allocate memory: fork: Unable to fork new process
[Mon Jul  8 13:41:41 2013] [error] (12)Cannot allocate memory: fork: Unable to fork new process
[Mon Jul  8 16:23:59 2013] [error] (12)Cannot allocate memory: fork: Unable to fork new process
[Mon Jul  8 16:24:34 2013] [error] (12)Cannot allocate memory: fork: Unable to fork new process
[Mon Jul  8 16:27:01 2013] [error] (12)Cannot allocate memory: fork: Unable to fork new process
[Mon Jul  8 17:24:44 2013] [error] (12)Cannot allocate memory: fork: Unable to fork new process
[Mon Jul  8 17:36:07 2013] [error] (12)Cannot allocate memory: fork: Unable to fork new process
[Mon Jul  8 18:06:15 2013] [error] (12)Cannot allocate memory: fork: Unable to fork new process
[Mon Jul  8 20:18:01 2013] [error] (12)Cannot allocate memory: fork: Unable to fork new process

答案1

您没有确切说明您对服务器的控制程度。如果您root安装了atop,请让它写入一段时间的日志,然后一旦遇到问题,您就可以查看历史记录并查看哪些进程消耗了所有内存。

或者,您可以通过添加交换空间来缓解这种情况(如果您有足够的磁盘空间),但这显然只是暂时的解决办法。机器交换时性能会显著下降……尽管不会像内存完全耗尽时那么严重!

相关内容