1

I'm experiencing the problem that I can't upload large images. Very similar to this problem: 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.

1

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(); 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.

  • 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 Feb 19 '15 at 18:20
  • 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 Feb 19 '15 at 19:31
  • 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 Feb 19 '15 at 20:20
  • 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 Feb 19 '15 at 21:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.