使用 ini_set("memory_limit", "-1") 仍然内存不足 [英] Using ini_set("memory_limit", "-1") and still out of memory

查看:194
本文介绍了使用 ini_set("memory_limit", "-1") 仍然内存不足的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将旧数据库 php 数组处理到新数据库.数据 .php 文件总共大约 220 MB.

I'm processing an old database php array to a new database. The data .php files are in total around 220 MB large.

我已经在脚本中插入了这些行,以便它可以正常运行:

I've inserted these lines in the script so that it should run fine:

ini_set("memory_limit", "-1");
set_time_limit(0);

这就是我包含产品的方式:

This is how I include the products:

// The exports made by PHPMYADMIN, exported as PHP-Array
require_once 'export/tx_ttproductsv2_products.php';
require_once 'export/tx_ttproductsv2_keyword.php';
require_once 'export/tx_ttproductsv2_keywords_in_products.php';
require_once 'export/tx_ttproductsv2_typebook.php';
require_once 'export/tx_ttproductsv2_typegospel7.php';
require_once 'export/tx_ttproductsv2_typemedia.php';

当脚本试图要求它们时,我收到此错误:

When the script is trying to require them I get this error:

PHP Fatal error: Out of memory (allocated 880541696) (试图分配 469762048 字节) in ......

PHP Fatal error: Out of memory (allocated 880541696) (tried to allocate 469762048 bytes) in ......

我有一个在 x64 Win 7 SP1 上运行的本地 EasyPHP 安装.我有 6 GB 内存,Intel i5.

I've got an local EasyPHP installation running on x64 Win 7 SP1. I've got 6 GB memory, Intel i5.

如何让 PHP 运行整个脚本而不出现内存错误?

How can I get PHP to run the whole script without the memory error?

推荐答案

内存限制来自操作系统,而非 PHP 本身.

Memory limitation comes from the OS, not from PHP itself.

您的脚本分配了 800MB,并正在尝试进一步分配 500MB

Your script allocated 800MB and is trying to allocate further 500MB

尝试在具有 64 位 PHP 的 64 位操作系统上运行该脚本.

Try to run the script on 64bit OS with 64 bit PHP.

这篇关于使用 ini_set("memory_limit", "-1") 仍然内存不足的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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