由于我将PHP应用程序移动到新服务器(在32位Windows Server 2003 R2上作为Apache 2.2模块运行的PHP/5.3.8),我收到了随机错误在PHP错误日志:随机“PHP致命错误:内存不足”错误
[09-Jan-2012 19:45:12] PHP Fatal error: Out of memory (allocated 786432) (tried to allocate 17 bytes) in D:\site\util\odbc-connection.php on line 675
[10-Jan-2012 17:56:49] PHP Fatal error: Out of memory (allocated 1310720) (tried to allocate 6144 bytes) in D:\site\logic\data.php on line 630
[10-Jan-2012 17:58:52] PHP Fatal error: Out of memory (allocated 524288) (tried to allocate 393216 bytes) in D:\site\users\edit-user.php on line 458
我很困惑,原因如下:
这是不当达到
memory_limit
你得到标准的错误消息:Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 800001 bytes)
无论如何,
memory_limit
默认为256MB
在服务器上,并在此应用程序上设置为128MB
(因此524,288字节应该不成问题)。在报告行有常很无辜的代码,如函数定义开始......
function linea($html){
...或的foreach()循环非常小的数组:
foreach($perfiles_basicos as $c => $v){
我想我已经丢弃了所有明显的东西(我甚至在硬盘中搜索了所有* .php,* .ini,.htaccess和* .conf文件中的memory_limit
字符串)和I 'w w ritten代码来检测和记录“128MB”限制的变化(没有发现任何东西),所以我现在很无能。
任何暗示或想法?
更新#1: Apache的error.log
显示我得到一个内存不足错误从PHP之后,Web服务器被重新启动。有些是手动重新启动,有些则崩溃这样的:
zend_mm_heap corrupted
12] [notice] Child 2524: Child process is exiting
[Mon Jan 09 19:45:12 2012] [notice] Parent: child process exited with status 1 -- Restarting.
[Mon Jan 09 19:45:13 2012] [warn] Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Mon Jan 09 19:45:13 2012] [notice] Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 configured -- resuming normal operations
[Mon Jan 09 19:45:13 2012] [notice] Server built: Sep 24 2011 00:32:50
[Mon Jan 09 19:45:13 2012] [notice] Parent: Created child process 6256
[Mon Jan 09 19:45:13 2012] [notice] Disabled use of AcceptEx() WinSock2 API
[Mon Jan 09 19:45:13 2012] [warn] Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Mon Jan 09 19:45:14 2012] [warn] Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Mon Jan 09 19:45:14 2012] [notice] Child 6256: Child process is running
[Mon Jan 09 19:45:14 2012] [notice] Child 6256: Acquired the start mutex.
[Mon Jan 09 19:45:14 2012] [notice] Child 6256: Starting 400 worker threads.
[Mon Jan 09 19:45:14 2012] [notice] Child 6256: Listening on port 443.
[Mon Jan 09 19:45:14 2012] [notice] Child 6256: Listening on port 80.
更新#2: ...和ODBC扩展日志记录以下错误:
No se puede cargar el controlador especificado debido al error del sistema 8 (Oracle in instantclient_11_2)
...其中system error 8地图到:
ERROR_NOT_ENOUGH_MEMORY 8 (0x8)
Not enough storage is available to process this command.
你使用任何框架? – Gerep 2012-01-10 18:07:19
您是否检查了系统上的内存使用情况? OOM通常在系统无法物理分配内存时发生,而不是在PHP达到了对请求的限制时。 – 2012-01-10 18:08:37
没有框架,只是香草PHP。我会尝试监视系统的内存。 – 2012-01-11 08:18:36