bigjdve
asked on
PHP Fatal error: Out of memory
I am on a web server: IIS 6, PHP 5.3 and MySQL.
I received this fastcgi error:
FastCGI Error
The FastCGI Handler was unable to process the request.
__________________________ __________ ____
Error Details:
• The FastCGI process exceeded configured activity timeout
• Error Number: 258 (0x80070102).
• Error Description: The wait operation timed out.
HTTP Error 500 - Server Error.
Internet Information Services (IIS)
So I have my admin set the following:
php.ini:
Max_execution_time = 1800
Fcgiext.ini:
RequestTimeout=1800
ActivityTimeout=1200
InstanceMaxRequests=10000
EnvironmentVars=PHP_FCGI_M AX_REQUEST S:10000
Then, I got this error:
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 469342568 bytes)
So, then I have him increase the memory_limit for php.ini to 1G.
But I am still running an out of memory problem. I am retrieving data from a table that have over 600K records.
My php page:
$mysqli = @new mysqli('localhost', 'user', 'pass!', 'database');
$sql = "select * from table";
if($result = $mysqli->query($sql))
{
echo '<pre>';
var_dump($result );
echo '</pre>';
}
else
{
die("Error in adding investor address: ".$sql." ==> ".$mysqli->error);
}
die("help!");
I received this fastcgi error:
FastCGI Error
The FastCGI Handler was unable to process the request.
__________________________
Error Details:
• The FastCGI process exceeded configured activity timeout
• Error Number: 258 (0x80070102).
• Error Description: The wait operation timed out.
HTTP Error 500 - Server Error.
Internet Information Services (IIS)
So I have my admin set the following:
php.ini:
Max_execution_time = 1800
Fcgiext.ini:
RequestTimeout=1800
ActivityTimeout=1200
InstanceMaxRequests=10000
EnvironmentVars=PHP_FCGI_M
Then, I got this error:
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 469342568 bytes)
So, then I have him increase the memory_limit for php.ini to 1G.
But I am still running an out of memory problem. I am retrieving data from a table that have over 600K records.
My php page:
$mysqli = @new mysqli('localhost', 'user', 'pass!', 'database');
$sql = "select * from table";
if($result = $mysqli->query($sql))
{
echo '<pre>';
var_dump($result );
echo '</pre>';
}
else
{
die("Error in adding investor address: ".$sql." ==> ".$mysqli->error);
}
die("help!");
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Do you really need 600 000 records available at one time? It sounds like you could probably address this by doing less.
ASKER
I know 600K of records is crazy. But I have to work with that table until I create a new database schema and be able to use that schema. That will not happen for a while so I have to assume that I am stuck with that table with 600K records. Is there some configuration that I can do to ensure that I don't run into this memory limitation in the future?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Just set the memory limit to 3GB or higher (or to anything like 90% of available RAM on the server), as I said. It is fine to use a lot of ram on rare situations (like you said "That will not happen for a while").
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I object.
Reason: Author did not respond to my additional comment. After one month, he posts a "solution", which is a clear effort to get the points back in unfair manner.
As we can read, the problem was in server "memory limit", and after magically the problem becomes "time limit". Important difference.
Proposal: Accept #33696903
Reason: Author did not respond to my additional comment. After one month, he posts a "solution", which is a clear effort to get the points back in unfair manner.
As we can read, the problem was in server "memory limit", and after magically the problem becomes "time limit". Important difference.
Proposal: Accept #33696903
I propose accept #33706565 because it explains how to do it, but give equal points to #33696903 as it tells you what the solution is.
I also think the real solution is #33698079. Why would you need every record in memory at one time?
I also think the real solution is #33698079. Why would you need every record in memory at one time?