<legend id='9pC0H'><style id='9pC0H'><dir id='9pC0H'><q id='9pC0H'></q></dir></style></legend>
    <i id='9pC0H'><tr id='9pC0H'><dt id='9pC0H'><q id='9pC0H'><span id='9pC0H'><b id='9pC0H'><form id='9pC0H'><ins id='9pC0H'></ins><ul id='9pC0H'></ul><sub id='9pC0H'></sub></form><legend id='9pC0H'></legend><bdo id='9pC0H'><pre id='9pC0H'><center id='9pC0H'></center></pre></bdo></b><th id='9pC0H'></th></span></q></dt></tr></i><div id='9pC0H'><tfoot id='9pC0H'></tfoot><dl id='9pC0H'><fieldset id='9pC0H'></fieldset></dl></div>

          <bdo id='9pC0H'></bdo><ul id='9pC0H'></ul>
        <tfoot id='9pC0H'></tfoot>

        <small id='9pC0H'></small><noframes id='9pC0H'>

        PHP 致命错误:内存不足(已分配 80740352)(尝试分配

        时间:2023-05-20
        <i id='lOWeg'><tr id='lOWeg'><dt id='lOWeg'><q id='lOWeg'><span id='lOWeg'><b id='lOWeg'><form id='lOWeg'><ins id='lOWeg'></ins><ul id='lOWeg'></ul><sub id='lOWeg'></sub></form><legend id='lOWeg'></legend><bdo id='lOWeg'><pre id='lOWeg'><center id='lOWeg'></center></pre></bdo></b><th id='lOWeg'></th></span></q></dt></tr></i><div id='lOWeg'><tfoot id='lOWeg'></tfoot><dl id='lOWeg'><fieldset id='lOWeg'></fieldset></dl></div>
        <legend id='lOWeg'><style id='lOWeg'><dir id='lOWeg'><q id='lOWeg'></q></dir></style></legend>

            • <bdo id='lOWeg'></bdo><ul id='lOWeg'></ul>
            • <tfoot id='lOWeg'></tfoot>

                    <tbody id='lOWeg'></tbody>

                  <small id='lOWeg'></small><noframes id='lOWeg'>

                  本文介绍了PHP 致命错误:内存不足(已分配 80740352)(尝试分配 12352 字节)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  当用户在我的网站上上传图片时,我收到此错误.

                  错误消息是PHP 致命错误:/home 中的内存不足(已分配 80740352)(试图分配 12352 字节)......."如何使用 php.ini 解决此问题?

                  这是我当前上传的 php.ini 设置

                  upload_max_filesize = 2000M ;post_max_size = 2000Mmax_file_uploads = 8

                  有什么想法我还需要添加什么来解决这个错误?

                  解决方案

                  最佳 memory_limit 值取决于您对上传文件的处理方式.您是使用 file_get_contents 还是 GD 库将文件读入内存?在这种情况下,将 memory_limit 增加到至少与 upload_max_filesize 相同,最好更大.

                  如果您使用 GD,请记住,GD 会将整个图像保存在内存中未压缩.这意味着它需要width * height * bit-depth 范围内的内存,例如,1024*768*32 = 25 165 824 bits = 3 MB 用于截图,或者对于 14 兆像素的图像多达 55 MB.

                  某些操作可能需要创建图像的副本,因此请考虑将 memory_limit 设置为将图像保留在内存中所需的两倍.如果不需要,请确保不要一次将所有图像加载到内存中.处理完图像后,您可以通过在句柄上调用 imagedestroy 来释放 GD 使用的内存.>

                  I get this error when users are uploading images on my site.

                  error msg is "PHP Fatal error: Out of memory (allocated 80740352) (tried to allocate 12352 bytes) in /home......." How can I fix this using php.ini?

                  Here is my current upload php.ini settings

                  upload_max_filesize = 2000M ;
                  post_max_size = 2000M
                  max_file_uploads = 8
                  

                  Any ideas what else I need to add to solve this error?

                  解决方案

                  The optimal memory_limit value depends on what you are doing with the uploaded files. Do you read the files into memory using file_get_contents or the GD library? In that case, increase memory_limit to at least the same as upload_max_filesize, preferably more.

                  If you are using GD, keep in mind that GD holds the entire image uncompressed in memory. This means that it takes memory in the range of width * height * bit-depth, e.g., 1024*768*32 = 25 165 824 bits = 3 MB for a screenshot, or as much as 55 MB for a 14 megapixel image.

                  Some operations may need to create a copy of the image, so consider setting memory_limit to the double of what you need to keep the image in memory. Also make sure to not load all images into memory at once if you don't have to. You can free the memory used by GD by calling imagedestroy on the handle when you are done working with the image.

                  这篇关于PHP 致命错误:内存不足(已分配 80740352)(尝试分配 12352 字节)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:ini_set("upload_max_filesize","200M") 在 下一篇:文件太大时上传不正确

                  相关文章

                  最新文章

                  1. <small id='296vt'></small><noframes id='296vt'>

                    <legend id='296vt'><style id='296vt'><dir id='296vt'><q id='296vt'></q></dir></style></legend>

                      <tfoot id='296vt'></tfoot>
                      <i id='296vt'><tr id='296vt'><dt id='296vt'><q id='296vt'><span id='296vt'><b id='296vt'><form id='296vt'><ins id='296vt'></ins><ul id='296vt'></ul><sub id='296vt'></sub></form><legend id='296vt'></legend><bdo id='296vt'><pre id='296vt'><center id='296vt'></center></pre></bdo></b><th id='296vt'></th></span></q></dt></tr></i><div id='296vt'><tfoot id='296vt'></tfoot><dl id='296vt'><fieldset id='296vt'></fieldset></dl></div>
                        <bdo id='296vt'></bdo><ul id='296vt'></ul>