In my file upload settings section it says "Your PHP settings limit the maximum file size per upload to 4 MB". What file exactly would i have to edit to fix this to a higher limit? Thanks for any help guys. (im still new to this :) )


Algirdas’s picture

You have to edit your php.ini file. Or ask your system administrator to do that for you.

henwoodr’s picture

I have GoDaddy as my web hosting company right now. So your saying they have to change this file?

dobe’s picture

OK this may help some noobs as well as the experienced:

For godaddy if you are using php 5 for your website you NEED to change the php.ini file to php5.ini that is located in your base directory. Or create a php5.ini file with the following values:

memory_limit = 96M
post_max_size = 64M
upload_max_filesize = 64M

Second you need to add the following values to the .htaccess file that comes pre packaged with Drupal in your base directory:

memory_limit = 96M
post_max_size = 64M
upload_max_filesize = 64M

Third you need to add to the following code to settings.php file that is located in /sites/default/:

ini_set('memory_limit', '96M');
ini_set('post_max_size', '64M');
ini_set('upload_max_filesize', '64M');

As you can see the php values are virtually the same with different syntax.

Hope this helps

VM’s picture

Curious as to why this is being changed in 3 ways. It should only need to be set in one way. If you have access to custom php.ini that's it should require changing.

Making a change in three different files is redundant and would then mean that if you need to make another change it would have to be changed in all three files again.

shababhsiddique’s picture

just did everything you said. i cant upload files larger than a few KB( suppose 50)

I cant even upload through plain php/html code. I created a new folder in my www directory of wamp and created a simple php application to test. THe upload limit was causing same error there.

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

VM’s picture

did you check the server error log ?

Chasen’s picture

FYI for anyone using the above steps, there's a TYPO in the 3rd block of code on the first line "meemory" which will throw errors.

should read:

ini_set('memory_limit', '96M');

EDIT: Which has now been fixed by OP :)

ranelpadon’s picture

Thanks for the hint. But, in my case, editing the settings.php and .htaccess files didn't work.

What worked for me was when I copied the existing GoDaddy server's php.ini file:
$ cp /usr/local/lib/php.ini ~/public_html

and then edited the target directives in the copied file:

memory_limit = 200M
post_max_size = 100M
upload_max_filesize = 50M

After that, the hosted Drupal site now uses the updated file upload settings, the loaded/updated Drupal's PHP settings could be verified also here:

pjkwis’s picture

I can create a custom php.ini file in my root for GoDaddy in order to change settings, but I can't seem to figure out how to copy the default php.ini file for a shared hosting box on the GoDaddy server to have the default file to modify. The server is a Windows box, not Linux.


cog.rusty’s picture

If you don't have access to php.ini, there are two place where you could possibly change the limit, depending on your host's setup.

In your settings.php file:

ini_set('post_max_size', '8M');
ini_set('upload_max_filesize', '8M');

In your .htaccess file:

php_value post_max_size 8M
php_value upload_max_filesize 8M

In my case the second one worked.

VM’s picture

using a custom php.ini file may also be an avenue for exploration.

This would mean getting a copy of the servers default php.ini, changing necessary values then uploading the php.ini file into your drupal installation. Doing it this way preserves the default settings for other sites/programs you have installed, and only allows the overides to happen for your drupal installation.

see for more information.

henwoodr’s picture

I have looked into the files and my settings.php file ( did not have the values you show so i tried to add them and that didnt work.

I have 2 .htaccess files ( and (, neither have the values you show.

I am so lost :(

cog.rusty’s picture

Add them in your first .htaccess file (the big one in Drupal's directory) near the top. Then check your /admin/settings/uploads again to see if your limit changed.

henwoodr’s picture

I added the values to the best spots i could see but it didn't work. Here is the exact text i have. Maybe you could look it over and let me know if i did it right?

# Apache/PHP/Drupal settings:

# Protect files and directories from prying eyes.

Order allow,deny

# Don't show directory listings for URLs which map to a directory.
Options -Indexes

# Follow symbolic links in this directory.
Options +FollowSymLinks

# Customized error messages.
ErrorDocument 404 /index.php

# Set the default handler.
DirectoryIndex index.php

# Override PHP settings. More in sites/default/settings.php
# but the following cannot be changed at runtime.

# PHP 4, Apache 1.

php_value post_max_size 100M 0
php_value upload_max_filesize 100M 0
php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0

# PHP 4, Apache 2.

php_value post_max_size 100M 0
php_value upload_max_filesize 100M 0
php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0

# PHP 5, Apache 1 and 2.

php_value post_max_size 100M 0
php_value upload_max_filesize 100M 0
php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0

# Requires mod_expires to be enabled.

# Enable expirations.
ExpiresActive On
# Cache all files for 2 weeks after access (A).
ExpiresDefault A1209600
# Do not cache dynamically generated pages.
ExpiresByType text/html A1

# Various rewrite rules.

RewriteEngine on

# If your site can be accessed both with and without the prefix www. you
# can use one of the following settings to force user to use only one option:
# If you want the site to be accessed WITH the www. only, adapt and
# uncomment the following:
# RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
# RewriteRule .* [L,R=301]
# If you want the site to be accessed only WITHOUT the www. prefix, adapt
# and uncomment the following:
# RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
# RewriteRule .* [L,R=301]

# Modify the RewriteBase if you are using Drupal in a subdirectory and
# the rewrite rules are not working properly.
#RewriteBase /drupal

# Rewrite old-style URLs of the form 'node.php?id=x'.
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{QUERY_STRING} ^id=([^&]+)$
#RewriteRule node.php index.php?q=node/view/%1 [L]

# Rewrite old-style URLs of the form 'module.php?mod=x'.
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{QUERY_STRING} ^mod=([^&]+)$
#RewriteRule module.php index.php?q=%1 [L]

# Rewrite current-style URLs of the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

# $Id: .htaccess,v 1.81 2007/01/09 09:27:10 dries Exp $

cog.rusty’s picture

I just put them once at the top, but I don't think it matters.

Why did you put the zeros at the end?

henwoodr’s picture

Well the zeros where there already when i opened the file in a .htaccess editor. But its still not working. Im about to give up on this.

VM’s picture

have you asked your host, if you are allowed to use a custom php.ini file ? checking their documentation may proove fruitful. They may have a knowledge base as well, or a forum to help you.

you could use a script to pull the default php.ini file and than change the values to what you need.

there is a scrpt of this nature here that may help you get your hands on the php.ini file. you will have to use the one from your server, as the can be server specific. In other words, giving you my custom php.ini file could cause you problems so its best to get it directly from your server.

gadzuk’s picture

Adding the following lines both to php.ini in my Drupal directory and settings.php worked for me

post_max_size = 8000000
upload_max_filesize = 8000000

Nexus5.01’s picture

Worked fine for me, I'm using HostGator as my host for reference :)


Make sure the php.ini is in the root of the Drupal installation - just incase!

viktor.mastoridis’s picture

Thanks a lot, after 2 hours of frustrations, this tip worked, on a 1and1 server.

Actually, in more detail (for 800mb limit):

php.ini file:
post_max_size = 800000000
upload_max_filesize = 800000000

ini_set('post_max_size', '800000000');
ini_set('upload_max_filesize', '800000000');

cog.rusty’s picture

Note that you are also limited by your php memory_limit. See what says about post_max_size.

This means that with a memory_limit of 64M, a single POST operation in a node editing form can upload less than that.

So, when people need to upload very large files they often use tools which partly bypass PHP's uploading method, for example with Flash, like which can upload up to 2G files.

sjohnston’s picture

That was the perfect solution for me.

Treesong’s picture

Thank you for your post! Writing out the zeroes instead of using an M is what did the trick for me. People should NOT be giving out advice which uses an M in place of six zeroes because that doesn't seem to work.

VM’s picture

Likely depends on what file you worked with. PHP.ini is distributed using M, for example.

rosshj’s picture

If that doens't work, here's an easier method.

Just register to the forum, download the Ioncube script, run it over URl
and you're set.

guru4vedi’s picture

As of now the only two ways to modify these settings is:

1. Via .htaccess per folder
2. Via php.ini (global)

It is possible to change this from script only in PHP <= 4.2.3

cog.rusty’s picture

Yes and no.

According to, in PHP <= 4.2.3
- upload_max_filesize used to be PHP_INI_ALL, so you could change it anywhere any time.
- post_max_size used to be PHP_INI_SYSTEM, so you could only change it in php.ini

However according to Drupal 6 requires 4.4.0 or higher and several contributed modules require PHP 5.

boogily’s picture

Thanks. That is the proper way to fix the .htaccess!

philosurfer’s picture

I tried several php.ini file configurations none of them worked untill i made the edit to the .htaccess file.

D6 OpenAtrium install btw.

We are the cult of personality.

Rskennan’s picture

I don;t know why, but I just found that:

post_max_size = 20
upload_max_filesize = 20

Didn't work.

Instead, I tried:
post_max_size = 100
upload_max_filesize = 20

Since I reasoned that maybe the overall post size had to be larger than the max upload size.

Whether my logic was right or wrong, it worked.

Good luck to anyone else who has this problem.

leop’s picture

In the Drupal API I find that post_max_size is divided by 2, as sanity check. It says it does it only for 4.7, but when I look at the 5.7 code that is installed at my website, it still uses the divide by 2 factor:

// sanity check- a single upload should not be more than 50% the size limit of the total post
    $post_max = _file_convert_to_mb(ini_get('post_max_size')) / 2;
cog.rusty’s picture

The API doc probably meant that the division by 2 was first introduced in Drupal 4.7. It was removed from Drupal 6 on 8-Oct-2007 and from Drupal 5 on 11-Feb-2008, as you can see here:

Drupal 5.7 was released on 28-Jan-2008, so the change has not made it into a release yet. You could look at the last patch and fix it yourself, by removing the two '-' lines and adding the '+' line in includes/

VM’s picture

or download the -dev version of drupal which will be come 5.8

JoshuaB86’s picture

I made a file called php.ini in notepad

I then put these two lines in it:

post_max_size = 100000000000
upload_max_filesize = 100000000000

that fixed it.

Twelvizm’s picture

Just wanted to bump the solution that worked for me. So simple, so easy.

mox386’s picture

this worked!

Anonymous’s picture

I discovered something whilst trying to up my max upload limit. On my server, if you force PHP5 via .htaccess, then php.ini no longer has any effect.

My server runs PHP4 by default and I had to add the line at the end of .htaccess to force it to run PHP5 for Drupal:

However, after doing this any instructions I put in the php.ini I placed in the root of my drupal install were ignored. Well, not ignored - they changed the settings for PHP4, but not for PHP5.

Does anyone know of a way around this problem?

Anonymous’s picture

Apparently renaming php.ini to php5.ini does the trick!

cazam’s picture

Hi there,

I've tried all the above solutions with no luck. Am breaking my head on this one. I did it before when I was on 1and1 but migrated to bluehost (thanks credit crunch) and having nightmares.

First of all no php.ini so I had to install this. Fine. Installed it in the root and also copied to me site root (as I have a couple of sites).
I added:
php_value upload_max_filesize = 20M
php_value post_max_size = 40M

To both php.ini and no luck

Also tried changing hta access as mentioned in this thread
But it broke my site so had to quickly revert back.

Tried to add the lines to settings.php in the sites root folder also but no luck.

I am on PHP 5 & Drupal 6 and going bonkers - can anyone please hep???


cog.rusty’s picture

For the values that you are using, you must have a memory_limit at least 64M.

If you added the "php_value ..." lines in a php.ini file, they are wrong. The syntax beginning with "php_value" is only for .htaccess files. See the examples.

Run a phpinfo() in a drupal page (see to check whether your settings for memory_limit, post_max_size and upload_max_filesize work or not.

Check for any limit in Drupal's settings in admin/settings/uploads (if you are using the core upload module) or in the settings of the module that you are using for your uploads.

cazam’s picture

hi again,
thanks for the response!
I checked the php.ini files and confirm that I had the following:
post_max_size = 40M
upload_max_filesize = 20M
Without the silly extra code I pasted in the above thread.

I am a bit scared of this phpinfo file as it says on the thread you gave me that it can break the formatting of the site. I know it will revert back, but, isn;t there a less frightening way?

I've checked with the host and they say change it to 200M is fine and the servers will just use as much memory as they have available.

cog.rusty’s picture

Another way to run phpinfo() and check if your settings work is to create a phpinfo.php text file, containing <?php phpinfo() ?>, upload it to Drupal's directory, and browse it.

Change what to 200M? The memory_limit? Then try it. At this moment it may be only 8M.

cazam’s picture

ahhh you are a genius, I did this and the memory limit is indeed only 32MB

sooo... in theory... if I change php.ini to read:

post_max_size = 32M
upload_max_filesize = 16M

then it may work?

Its not really big enough for what I need, but I guess that is a debate with the host.

Thanks again!

cazam’s picture

php info does read
post_max_size = 40M
upload_max_filesize = 20M

And also memory_limit = 32M

But then I am not too sure why when I go to the file upload box in drupal it says:
The maximum upload size is 1 MB.

This doesn't correspond with any of the numbers in the phpinfo

cog.rusty’s picture

The 1MB limit is a Drupal settings in admin/settings/uploads (if you are using the core upload module), or in the settings of the module that you are using for your uploads.

The 32M memory_limit may be a limit from your host, but maybe not and you just need to set it. Do you have a memory_limit setting in your php.ini? (or in your .htaccess or in drupal's settings.php). if not, try:

memory_limit = 64M
post_max_size = 40M
upload_max_filesize = 39M

and check again what phpinfo() says.

cazam’s picture

as I am trying to do a podcast, which I have done via adding a taxonomy term Podcast Item and then added terms to this taxonomy for each DJ and thus each podcast, I cannot find anywhere in taxonomy or any of these terms I added to change the file upload limit from 1MB.

I also looked at the general File Uploads settings and these are set to 100MB and 1000MB although it tells me my phpinfo limit is 20M which I already know as you kindly helped me set and check this.

I'm trying the memory limit settings above now but still unsure how to alleviate the 1MB upload problem within the Podcast Item taxonomy.

...thanks for being so patient with me!!!

cazam’s picture

ah you are so clever! I increased the memory_limit in the php.ini as you said and now - voila - it is 64MB


Now just that pesky little 1MB limit that is somehow attached to the taxonomy term Podcast Item I created...

cog.rusty’s picture

Which module are you using to upload the podcasts?

If the 1M size limit is not in the settings of the upload module included in core, then it must be in the settings of some other file-handling module.

cazam’s picture

using taxonomy module
created a taxonomy called Podcast Items
And then I have items within that which are the DJs

Its probably staring me straight in the face but it seems to keep eluding me!

cog.rusty’s picture

Taxonomy does not upload files. The file size setting is in some other module, such as upload, filefield, imce...

cazam’s picture

it has to be in there somewhere...

cazam’s picture

thanks so much for all your help. In the end it was a simple case of re-entering values in the file uploads page and the refresh did the job!
thanks again

cviga’s picture

You must to edit settings.php in /sites/default/settings.php
add this lines

ini_set('post_max_size', '800000000');
ini_set('upload_max_filesize', '800000000');

and edit php.ini

post_max_size = 800000000
upload_max_filesize = 800000000

When you finish that restart wamp or xamp... its work... default upload limit is 762 MG

SkyChew’s picture

i am using Drupal on WAMP on a local machine.
you can edit the php.ini and restart the service for the wamp.

or you can edit the upload limit size increase just for the site without adjusting the global php.ini
i tried the settings.php method and a php.ini in the local folder method. both didnt work.
editing the .htaccess works for me

just added these 2 lines in the root .htaccess
php_value post_max_size 20M
php_value upload_max_filesize 10M
find this code and add the 2 lines of code in

# PHP 5, Apache 1 and 2.
<IfModule mod_php5.c>
  php_value post_max_size 			20M			
  php_value upload_max_filesize 		10M

my memory_limit is by default 128M as seen in phpinfo();

hope this helps

zinasahib’s picture

I ran into the same problem, and tried editing the settings and php.ini files with no success,
Then I noticed there is an entry in the php.ini file:

under : File Uploads:

upload_max_filesize = 2M;

I simply changed it to 20M and it works now!

drupalninja99’s picture

MOSSO hosting didnt let me change the settings from ini_set() but when I modifed .htaccess with the settings you provided, that worked for me - thx!

vladislavbezruchenko’s picture

after changes in php.ini make

apachectl restart

to restart Apache on U'r linux server

artscientific’s picture

Just hitting the keywords for those searching on this issue, hopefully it will save someone a little time. I could change the max memory using the other methods (settings.php & and php.ini) BUT to get the max upload filesize i had to add this to the .htaccess:

php_value upload_max_filesize 10M
php_value post_max_size 20M
php_value memory_limit 128M

Be careful as a previous post had listed an incorrect syntax for the .htaccess file, this one works.

Good Luck,
We love Drupal and Ubercart at ;-D

prokopton’s picture

If you're using Debian or Ubuntu and have access as root or sudo:

nano /etc/php5/apache2/php.ini --> edit this file using nano or gedit or another text editor

upload_max_filesize = 2M is predefined.

change "2M" to another value. For example:

upload_max_filesize = 30M

That worked for me. I didn't have to edit php.ini or .htaccess in drupal's root directory.

prokopton’s picture

Didn't have to edit php.ini or .htaccess in drupal's root directory or /sites/default/settings.php .

broosfonck’s picture

To restart your xamp or wamp...

azovsky’s picture

Rory’s picture

Copying (or renaming) your php.ini file to php5.ini may be all you have to do, if you're using PHP 5.x and haven't done this already.

Check your web root directory on your website hosting manager, above your Drupal website directory for this configuration file.

sjdavis’s picture

I found the problem to be the Apache2 httpd.conf file:

Original setting:
LimitRequestBody 102400 <--- Upload limit was set to 100k

New setting:
LimitRequestBody 0 <--- set to unlimited file size

** A restart/reload of Apache is required for the change to take affect.

Ironically, there is an example of how to limit uploads to be 100k in the apache
LimitRequestBody documentation

I don't recommend you set the LimitRequestBody to 0 for production systems as it could leave you open to a D.O.S. attack. Serious consideration should be given to what the limit should be for your use case. Nonetheless, this fixed my problem - hope it helps.

neorg’s picture

When your Drupal is hosten on a machine with ISPconfig non of the above tips works.

How-To change php.ini setting with ISPconfig
1. First of all change your global php.ini file that is used by Apache. Usualy this is /etc/php5/apache2/php.ini If it's not on that locattion you can find it using the command:

locat php.ini

It's possible you find more than one php.ini file. Edit the file that apache uses.
Change this lines
Fore maximum upload size of alle file at the same time
post_max_size = 2M
post_max_size = 64M
maximum the file size
upload_max_filesize = 2M
upload_max_filesize = 64M
Suppose You uploads 3 files of 6M, than [upload_max_filesize] must be at least 6M and [post_max_sized] must be at leat 18M (3x6m)

If you are going to upload large file you also have th increase the value of the Memory Limit. Ste the memory limit variable to at least the post_max_size
memory_limit = 128M

2. Second Changes the settings in your ISPconfig admin panel
This can only be don by the admin of the ISPconfig.

- Login to ISPConfig
- Sites
- Select a site
- Tab [Options]
- Add the following to the field (text area) Custom php.ini settings

memory_limit = 96M
post_max_size = 64M
upload_max_filesize = 64M

Notice that the changes in ISPConfig are not eminently available. It take at at least one before the changes are processed by the server. if you heve root privileges you can run this command to precess the changes immediately :


Now you can upload large files.

There's always a little something left.

VM’s picture

post max should be larger than max file size. Otherwise a post with a 64M upload will not be saved if it has any other fields.

hardik.creole’s picture

Godaddy PHP change max upload file size using setting file

Please read following url. Which describes which name should be given to the php setting files

VM’s picture

Please don't bump old posts with information that can already be found within the thread.

Also of note (and has been stated in the thread) post_max_size should always be higher than upload_max_filesize. an esxtra 10 M should suffice in most situations.