Jump to content

Increasing memory_limit and post_max_size


Henrik
 Share

Recommended Posts

If I want to increase php memory-limit and post_max_size would adding these lines in .htaccess do it?

(If the limits of the Hoster allowed it):

<IfModule mod_php5.c>

  ...
  php_value memory_limit 256M
  php_value post_max_size 256M
  php_value upload_max_filesize 200M  
</IfModule>

Thanks!

Link to comment
Share on other sites

Hi,

If your PHP setup is running in safe mode, you can only change values from the php.ini file.

If the upload_max_filesize is larger than post_max_size, you must increase post_max_size
so that it is bigger than upload_max_size.

If the value of post_max_size is larger than memory_limit, you must increase memory_limit
so that it is larger than post_max_size.

Try increasing the following values in php.ini, for example:

memory_limit = 32M
upload_max_filesize = 24M
post_max_size = 32M
 

  • Like 2
Link to comment
Share on other sites

Thank you, pwired!

Safe mode is off. I just checked this with phpinfo. Should this be on?

I'm on shared hosting. I've already tried to change these values with php.ini, which I uploaded in the pw-root. I checked then the values with phpinfo. In the root folder the changes took effect but not in the subfolders. Somewhere I've read that the php.ini file has to be also in all (or some) subfolders. Is this correct? And which subfolders would this be in PW?

Thank you!

PS: The issue is: I can only upload images with a file size up to ax. 3MB. I searched the forum and guessed this could have to do with memory_limit and post_max_size.

Link to comment
Share on other sites

Not recommended but you can try a work around by creating .user.ini file and put it in the directory

where the actual upload script resides. You can give it for example these values:
upload_max_filesize = 24M
post_max_size = 32M

Did you check your shared hosting restrictions ? Some shared hosting have file size restricted.

What file size can you upload successfully ? That will give you something to start with.

Link to comment
Share on other sites

Not recommended but you can try a work around by creating .user.ini file and put it in the directory

where the actual upload script resides.

Which directory would that be?

Did you check your shared hosting restrictions ? Some shared hosting have file size restricted.

In phpinfo I find these values:

memory_limit   120M

post_max_size   8M

upload_max_filesize   40M

What file size can you upload successfully ? That will give you something to start with.

I can upload up to ax. 3MB. I tried several files with 4 and 7MB which don't upoload.

Link to comment
Share on other sites

So, a little update here:

I'm still working on this. What I can add to what I already reported is that I get the following error if I upload an image larger than ax. 3MB:

TypeError: response is null
    if(response.error !== undefined) response = [response];

(This is in FF. In Safari and Chrom I get similar errors.)

Hints this to the assumed issue with memory_limit and / or post_max_size?


Furthermore I spoke with the hoster again. php-values are:

memory_limit = 60M (Maximum)
post_max_size = 8M (can be increased)
upload_max_filesize = 40M (can be increased)
max_execution_time = 20 (Maximum)

With .user.ini in root I set the following php values. Changes take effect also in subdirectories: 

memory_limit = 256M
post_max_size = 200M
upload_max_filesize = 150M
max_execution_time = 100

But no effects, same error. I guess hosting restrictions espacially memory_limit don't allow upload of larger images.

Am I right? Or does anyone has another idea?

Thanks!

PS: I am building this site for a company with some fashion shops. So image upload is an important feature. They get images by their photographer up to sometimes 6-8MB. I am very happy with what I could buildt for them so fare. Thanks to PW the update process will be very easy, fast and effective for them. I would love to see image upload also function as easy - without them having to resize the images before. I'm aware that this might be not possible because of the hosting restrictions. But before I consider other possibilities like Client Side Image Resizing or changing the host I want to be sure to do all I can to make it work in this envirmonment.

Any help is very much appreciated!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...