久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

即使未達到 memory_limit,PHP 內存不足錯誤

PHP out of memory error even though memory_limit not reached(即使未達到 memory_limit,PHP 內存不足錯誤)
本文介紹了即使未達到 memory_limit,PHP 內存不足錯誤的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我剛剛繼承了一個帶有 PHP 腳本的站點,該腳本始終以 117 MB 的速度耗盡內存.即使我通過 php.ini 將 PHP 的 memory_limit 變量增加到 312 MB,也會發(fā)生這種情況.

I have just inherited a site with a PHP script that is consistently running out of memory at 117 MB. This happens even when I increase PHP's memory_limit variable to 312 MB, which I'm doing via php.ini.

多虧了 pcguru 的一個很好的線索,這個問題現(xiàn)在已經解決了.請參閱下面開始的答案:我終于找到了答案

ini_get('memory_limit') 返回在 php.ini 中設置的值,因此我確定更改該值后 Apache 已重新啟動.我正在使用 memory_get_usage(true) 返回腳本在整個過程中的各個點消耗的內存.當它達到 117 MB 時,它一直失敗.

ini_get('memory_limit') returns the value set in php.ini, so I'm certain Apache has restarted after changing the value. I'm using memory_get_usage(true) to return the memory consumed by the script at various points along the way. And it's consistently failing when it gets to 117 MB.

是否有一些我不知道的內部 PHP 限制,它從未為單個腳本分配超過 117MB 的空間?

Is there some internal PHP limit I'm unaware of that has it never allocate more than 117MB to an individual script?

服務器有 1GB 的內存并運行 CentOS.我有 root shell 訪問權限.PHP 是 5.3.18 版本.MySQL 是 5.1.66-cll 版本.

The server has 1GB of RAM and is running CentOS. I have root shell access. PHP is version 5.3.18. MySQL is version 5.1.66-cll.

此腳本位于用戶名/密碼后面,我無法提供對其的公開訪問.

This script is behind a username/password and I can't provide public access to it.

編輯添加:

1) 感謝大家迄今為止的幫助.您可以在我對特定用戶評論的回復中找到更多信息,并在下面的各種答案下找到.

1) Thanks all for your help to date. You'll find more info in my replies to specific user comments under various answers below.

2) Suhosin 肯定沒有安裝.我已經檢查了多個地方,包括運行腳本和檢查常量以及運行 php -v

2) Suhosin is definitely not installed. I've checked in multiple places including running a script and check for constants and running php -v

3) apache 日志沒有記錄我收到的特定錯誤消息.日志記錄在 php.ini 中打開.我通過 grep 來搜索整個日志.

3) The apache log has no record of the specific error message I'm getting. Logging is switched on in php.ini. I piped through grep to search the entire log.

4) 是否有可能在這種情況下報告了錯誤的錯誤?

4) Is it possible the wrong error is being reported in this case?

推薦答案

我終于找到了答案.線索來自 pcguru 的回答,開頭是因為服務器只有 1 GB 的 RAM...".

I have finally found the answer. The clue came from pcguru's answer beginning 'Since the server has only 1 GB of RAM...'.

我憑直覺查看了 Apache 是否有自己的內存限制,因為這些限制可能會影響 PHP 分配內存的能力.就在 httpd.conf 的頂部,我發(fā)現(xiàn)了以下聲明:RLimitMEM 204535125

On a hunch I looked to see whether Apache had memory limits of its own as those were likely to affect PHP's ability to allocate memory. Right at the top of httpd.conf I found this statement: RLimitMEM 204535125

這是由 whm/cpanel 放在那里的.根據(jù)以下網(wǎng)頁 whm/cpanel 在虛擬服務器上錯誤地計算了其值...http://forums.jaguarpc.com/vps-dedicated/17341-apache-memory-limit-rlimitmem.html

This is put there by whm/cpanel. According to the following webpage whm/cpanel incorrectly calculates its value on a virtual server... http://forums.jaguarpc.com/vps-dedicated/17341-apache-memory-limit-rlimitmem.html

內存不足的腳本大部分通過了,所以我將 RLimitMEM 增加到 268435456 (256 MB) 并重新運行腳本.它完成了數(shù)組合并并生成了 csv 文件以供下載.

The script that runs out of memory gets most of the way through, so I increased RLimitMEM to 268435456 (256 MB) and reran the script. It completed its array merge and produced the csv file for download.

ETA:在進一步閱讀 RLimitMEM 和 RLimitCPU 之后,我決定將它們從 httpd.conf 中刪除.這允許 ini_set('memory_limit','###M') 工作,我現(xiàn)在為該特定腳本提供它需要的額外內存.我還將那臺服務器上的 RAM 增加了一倍.

ETA: After further reading about RLimitMEM and RLimitCPU I decided to remove them from httpd.conf. This allows ini_set('memory_limit','###M') to work, and I now give that particular script the extra memory it needs. I also doubled the RAM on that server.

感謝大家?guī)椭鷻z測這個相當棘手的問題,尤其是 pcguru,他提出了讓我找到解決方案的重要線索.

Thank you to everyone for your help in detecting this rather thorny issue, and especially to pcguru who came up with the vital clue that got me to the solution.

這篇關于即使未達到 memory_limit,PHP 內存不足錯誤的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯(lián)系我們刪除處理,感謝您的支持!

相關文檔推薦

Joining 2 tables in SELECT(MYSQL/PHP)(在 SELECT(MYSQL/PHP) 中加入 2 個表)
How to make lt;option selected=quot;selectedquot;gt; set by MySQL and PHP?(如何使lt;option selected=“selectedgt;由 MySQL 和 PHP 設置?)
Auto populate a select box using an array in PHP(使用 PHP 中的數(shù)組自動填充選擇框)
PHP SQL SELECT where like search item with multiple words(PHP SQL SELECT where like search item with multiple words)
json_encode produce JSON_ERROR_UTF8 from MSSQL-SELECT(json_encode 從 MSSQL-SELECT 產生 JSON_ERROR_UTF8)
MySQL ORDER BY rand(), name ASC(MySQL ORDER BY rand(),名稱 ASC)
主站蜘蛛池模板: 国产95在线 | 欧美日韩在线电影 | 色综合久久天天综合网 | 欧美精品欧美精品系列 | 久久久精品影院 | 日本精品一区二区三区在线观看 | 精品一区二区三区视频在线观看 | 激情欧美一区二区三区中文字幕 | 免费视频99| 免费的网站www | 久久99精品久久 | 亚洲一区二区免费电影 | 日本三级全黄三级三级三级口周 | 中文字幕一二三区 | 国产精品美女久久久久aⅴ国产馆 | h视频网站在线观看 | 日本视频在线播放 | 欧美精品久久久久久 | 日本成人福利视频 | 国产精品九九视频 | 亚洲免费人成在线视频观看 | 成人乱人乱一区二区三区软件 | 国产清纯白嫩初高生视频在线观看 | 国产高清视频在线 | 欧美激情国产日韩精品一区18 | 精品成人免费视频 | 欧美a级成人淫片免费看 | 免费看黄视频网站 | 中文字幕一区二区三区精彩视频 | 人成在线 | 一区二区中文 | 国产一区二区三区在线看 | 欧美亚洲一区二区三区 | 中文字幕爱爱视频 | 黑人巨大精品欧美黑白配亚洲 | 国产99精品| 国产一区久久久 | 精品欧美| 精品在线免费看 | 在线免费观看a级片 | 天天躁日日躁性色aⅴ电影 免费在线观看成年人视频 国产欧美精品 |