Dre*_*rew 14 php arrays xdebug suhosin
我在PHP中有一个奇怪的内存问题.我认为有些东西只允许一个数组最大为0.25M.看起来脚本在崩溃之前只使用了大约6M.
这是xdebug的输出:

这是它正在调用的功能.sql查询的结果是大约800行文本.
public function getOptions(){
$sql = "select Opt,
Code,
Description
from PCAOptions";
$result = sqlsrv_query($this->conn,$sql);
$arrayResult = array();
echo ini_get('memory_limit'); //this confirms that my memory limit is high enough
while($orderObject = sqlsrv_fetch_object($result,'PCA_Option')){
array_push($arrayResult, $orderObject);
}
return $arrayResult;
}
Run Code Online (Sandbox Code Playgroud)
所以,我不知道这是如何或为什么有效,但我通过注释掉 .htaccess 文件中的这两行来解决这个问题:
# php_value memory_limit 1024M
# php_value max_execution_time 18000
Run Code Online (Sandbox Code Playgroud)
我这样做是因为我注意到 phpinfo() 在“master”和“local”两列中为这些设置返回了不同的值。
我的 php.ini 的 memory_limit=512M 和 max_execution_time=3000,而我的 .htacces 文件具有上述值。我认为 .htaccess 只会覆盖 php.ini 中的任何内容,但我想这会导致冲突。这可能是 php 中的一个错误吗?