【发布时间】:2013-10-16 08:46:03
【问题描述】:
问题:当客户登录并在管理面板中保存产品时,然后刷新前端并显示错误:
Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 88 bytes) in /home/staging/public/kralengroothandel/app/code/local/Zend/Db/Statement/Pdo.php on line 297
或
Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 83 bytes) in /home/staging/public/kralengroothandel/lib/Varien/Simplexml/Element.php on line 196
Pdo.php 行,出现问题的地方:
public function _execute(array $params = null)
{
try {
if ($params !== null) {
return $this->_stmt->execute($params);
} else {
return $this->_stmt->execute();
}
第二名:
public function fetchAll($style = null, $col = null)
{
if ($style === null) {
$style = $this->_fetchMode;
}
try {
if ($style == PDO::FETCH_COLUMN) {
if ($col === null) {
$col = 0;
}
return $this->_stmt->fetchAll($style, $col);
} else {
return $this->_stmt->fetchAll($style);
}
元素.php:
if (!$desc) {
return false;
}
我在本地机器上有相同的代码和数据库,但我没有这个问题。
memory_limit 设置在 512M 上,我想问题不在这里,因为 Zend_Db 库设置了内部内存限制。所以我尝试将ini_set('memory_limit', '1024M'); 放在Pdo.php 中,但这也无济于事。我有 OneStepCheckout 扩展(也许这是我遇到这个问题的原因)。我使用 Ngnix。也许有人有同样的错误?
我的服务器上的php-fpm.conf:
pm = dynamic
pm.max_children = 4
pm.start_servers = 1
pm.min_spare_servers = 1
pm.max_spare_servers = 2
request_terminate_timeout = 0
request_slowlog_timeout = 0
chdir = /
php_admin_value[memory_limit] = 512M
php_admin_value[post_max_size] = 128M
php_admin_value[post_max_vars] = 64000
php_admin_value[max_execution_time] = 3600
php_admin_value[realpath_cache_size] = 16m
【问题讨论】:
-
尝试在你的根目录下的.htasscess文件中设置内存限制,像这样“php_value memory_limit 1024M”
-
我忘了说,我用的是ngnix。
标签: magento zend-framework memory-leaks