<blockquote>
  <p>Where do I have to place the php.ini so the upload script knows about it?</p>
</blockquote>

<p>In the same folder that Craft's public index.php lives in should be the only place it's required.</p>

<p>You can put a <code>phpinfo.php</code> in that same folder with the contents <code>&lt;?php phpinfo();</code> and load that page in the browser to see if your php.ini changes have taken affect.</p>

<blockquote>
  <p>Also it doesn't depend on the file size but on the image resolution.</p>
</blockquote>

<p>That's because there isn't a 1:1 correlation because an images size on disk and how much RAM is required to load that image into memory.</p>

<p><code>post_max_size</code>, <code>memory_limit</code> and <code>max_execution_time</code> and <code>upload_max_filesize</code> are usually the common culprits when dealing with uploading large files in PHP.</p>

CC BY-SA 3.0
2015-02-19T18:20:31.503Z
Yes, I'm checking the settings via `phpinfo()` and they do take effect. Now I've set `post_max_size = 64M` `memory_limit = 256M` `max_execution_time = 240` `upload_max_filesize = 40M` and it still doesn't work for large images. Could it be something else maybe?
Andreas Linnert
CC BY-SA 3.0
2015-02-19T19:31:54.600Z
Sure, tons of other possibilities.  If your server has mod_security or Suhosin installed, they could be interfering. If you're running SELinux, they have all sorts of weird settings, etc.
Brad Bell
CC BY-SA 3.0
2015-02-19T20:20:38.210Z
The phpinfo doesn't say anything about mod_security or Suhosin (I can find information about suhosin on another web space though). Also the line `System` only says `Linux info 3.0 #1337 SMP` (while the other one says `FreeBSD`). Can you say what kind of Linux the former one is?
Andreas Linnert
CC BY-SA 3.0
2015-02-19T21:09:44.560Z
No idea... you're probably going to be better off contacting your host and telling them what you're trying to do. They'll be much more familiar with the server and probably have ran into this many times before.
Brad Bell
CC BY-SA 3.0
2015-02-18T21:32:51.533Z
2015-02-18T21:32:51.533Z
Brad Bell
<p>I'm experiencing the problem that I can't upload large images. Very similar to this problem: <a href="https://craftcms.stackexchange.com/questions/6521/craft-cms-max-image-resolution">Craft CMS max image resolution?</a> But I couldn't solve the problem so far.</p>

<p>My first question is: Where do I have to place the <code>php.ini</code> so the upload script knows about it? (My web hosters help pages tell me to upload the file in <strong>every</strong> directory that need the ini files settings) I've tried <code>/craft/app</code> (next to <code>index.php</code> and <code>Craft.php</code>) and <code>/htdocs</code> (the web root).</p>

<p>Plus: I've tried to upload the exact same images to Craft at another web hoster where it works fine. But the limitations there are even stricter than where the problem occurs).</p>

<p>That means: if the location of the <code>php.ini</code> was right the values of <code>post_max_size</code>, <code>memory_limit</code> and <code>max_execution_time</code> are not the problem. Also it doesn't depend on the file size but on the image resolution.</p>

<p>image1.jpg | 703 x 951 pixels | ~850,000 Bytes &rarr; <em>does work</em><br>
image2.jpg | 2520 x 1680 pixels | ~750,000 Bytes &rarr; <em>doesn't work</em><br>
image2.jpg | save with same resolution as: "image3.jpg" &rarr; <em>doesn't work</em><br>
image2.jpg | save with lower resolution as: "image4.jpg" &rarr; <em>does work</em></p>

<p>Does anyone know what else I could check to solve that problem?</p>

<p>Thanks for any help.</p>

<assets><image><upload><error>
Server requirements for uploading large images
# Server requirements for uploading large images

(Asked by: username_0 on 2015-02-18)

I'm experiencing the problem that I can't upload large images. Very similar to this problem: [Craft CMS max image resolution?](https://craftcms.stackexchange.com/questions/6521/craft-cms-max-image-resolution) But I couldn't solve the problem so far.

My first question is: Where do I have to place the `php.ini` so the upload script knows about it? (My web hosters help pages tell me to upload the file in **every** directory that need the ini files settings) I've tried `/craft/app` (next to `index.php` and `Craft.php`) and `/htdocs` (the web root).

Plus: I've tried to upload the exact same images to Craft at another web hoster where it works fine. But the limitations there are even stricter than where the problem occurs).

That means: if the location of the `php.ini` was right the values of `post_max_size`, `memory_limit` and `max_execution_time` are not the problem. Also it doesn't depend on the file size but on the image resolution.

image1.jpg | 703 x 951 pixels | ~850,000 Bytes → *does work*  
image2.jpg | 2520 x 1680 pixels | ~750,000 Bytes → *doesn't work*  
image2.jpg | save with same resolution as: "image3.jpg" → *doesn't work*  
image2.jpg | save with lower resolution as: "image4.jpg" → *does work*

Does anyone know what else I could check to solve that problem?

Thanks for any help.

**Tags:** assets, image, upload, error

---

## 1 answers

### Answer by username_1 on 2015-02-18. Score: 1 | Accepted answer

> Where do I have to place the php.ini so the upload script knows about it?

In the same folder that Craft's public index.php lives in should be the only place it's required.

You can put a `phpinfo.php` in that same folder with the contents `php phpinfo();</code and load that page in the browser to see if your php.ini changes have taken affect.`

> Also it doesn't depend on the file size but on the image resolution.

That's because there isn't a 1:1 correlation because an images size on disk and how much RAM is required to load that image into memory.

`post_max_size`, `memory_limit` and `max_execution_time` and `upload_max_filesize` are usually the common culprits when dealing with uploading large files in PHP.

> **Comments:**
> **username_0**: Yes, I'm checking the settings via `phpinfo()` and they do take effect. Now I've set `post_max_size = 64M` `memory_limit = 256M` `max_execution_time = 240` `upload_max_filesize = 40M` and it still doesn't work for large images. Could it be something else maybe?  
> **username_1**: Sure, tons of other possibilities.  If your server has mod_security or Suhosin installed, they could be interfering. If you're running SELinux, they have all sorts of weird settings, etc.  
> **username_0**: The phpinfo doesn't say anything about mod_security or Suhosin (I can find information about suhosin on another web space though). Also the line `System` only says `Linux info 3.0 #1337 SMP` (while the other one says `FreeBSD`). Can you say what kind of Linux the former one is?  
> **username_1**: No idea... you're probably going to be better off contacting your host and telling them what you're trying to do. They'll be much more familiar with the server and probably have ran into this many times before.  

---

