首頁 >後端開發 >php教程 > php上载:Fatal error: Allowed memory size of

php上载:Fatal error: Allowed memory size of

WBOY
WBOY原創
2016-06-13 13:10:031024瀏覽

php下载:Fatal error: Allowed memory size of
日志文件:tdnlog.log 大小:752MB

下载类

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
    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
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
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 ....都试下。
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn