日志文件:tdnlog.log 大小:752MB
下载类
- PHP code
function download($filepath, $filename = '') { if(!$filename) $filename = basename($filepath); if(is_ie()) $filename = rawurlencode($filename); $filetype = fileext($filename); $filesize = sprintf("%u", filesize($filepath)); if(ob_get_length() !== false) @ob_end_clean(); header('Pragma: public'); header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT'); header('Cache-Control: no-store, no-cache, must-revalidate'); header('Cache-Control: pre-check=0, post-check=0, max-age=0'); header('Content-Transfer-Encoding: binary'); header('Content-Encoding: none'); header('Content-type: '.$filetype); header('Content-Disposition: attachment; filename="'.$filename.'"'); header('Content-length: '.$filesize); readfile($filepath); exit; }
文件在100MB之内正常 但超过就会报下面的错误 我把php.ini里面的memory_limit设置为512MB也不管用 这是怎么个情况啊
- PHP code
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 750743553 bytes) in /var/www/nms/framebase/libs/functions/extention.func.php on line 233
有一种解决办法是压缩为zip包
phpmyadmin的数据库导出下载就不会出现这个 它那个也没压缩 看了半天phpmyadmin的代码 各种混乱和纠结 求助吧
------解决方案--------------------
那就再改大点。800MB,900MB,1G ....都试下。