开发者

valid memory limit test

开发者 https://www.devze.com 2023-02-09 17:59 出处:网络
I´m having trouble with a crashing ION-Cube module. The module imports csv data into our database, but if the csv file is to large (15+M)

I´m having trouble with a crashing ION-Cube module. The module imports csv data into our database, but if the csv file is to large (15+M) the result is a internal server error.

The support told me my server does not have enough RAM to run the module. The server has 1gb RAM built in so I wrote a simple test script to check if ini_set works.

<pre>
<?php 
function tryAlloc($megabyte){
    echo "try allocating {$megabyte} megabyte...";
    $dummy = str_repeat("-",1048576*$megabyte);
    echo "pass.";
    echo "Usage: " . memory_get_usage(true)/1048576; 
    echo " Peak: " . memory_get_peak_usage(true)/1048576;
    echo "\n";
}   
for($i=10;$i<1000;$i+=50){
    $limit = $i.'M';
    ini_set('memory_limit', $limit); 
    echo "set memory_limit to {$limit}\n"; 
    echo "memory limit is ". ini_get("memory_limit")."\n";
    tryAlloc($i-10);
}

?>
</pre>

T开发者_运维技巧his runs without any problems. Are there any major flaws in this test? We are having lots of trouble with this module and the support keeps telling us that the problem is our server. -.-

PS: No I can not access php.ini. No I can not use .htaccess to set the memory limit. No I have no way to edit fix/debug the module.

0

精彩评论

暂无评论...
验证码 换一张
取 消