Geeks and God Podcast

(206)984-3694geeksandgod@gmail.comfeeds.feedburner.com/geeksandgod
login | register

Upload File Size Limits

My current PHP settings limit file uploads to 2MB.
How do I change this? Thanks so much.

htaccess

There's basically 2 ways you can do this...I only know the syntax for one of them (hopefully someone else can fill in the gaps). You change this upload limit (and related settings) in either the htaccess or php.ini files on your server. The htaccess file ships with the drupal core, while the php.ini file will be specific to your webhost (consult them on if/where that's located).

In general, it's better practice to change this setting in the php.ini, but it's not available on most shared hosting packages and unless your site is quite large, the difference between doing it here and htaccess is minimal.

That being said...the htaccess file ships with your core drupal package. It's preceeded by a period (so it's .htaccess) which means that it will be hidden on any unix based system (either your web server or on a Mac). A good FTP program will have the option to 'show hidden files' to allow you to find it.

Along with upload limit, you'll need to increase php timeout and memory limits in order to make sure your system will 'wait' long enough and dedicate enough memory to make the upload happen. Here's an example of the syntax of increasing your upload limit in htaccess. (anyone want to pitch in the php.ini syntax?) Hope this helps:

php_value upload_max_filesize 75M
php_value post_max_size 150M
php_value memory_limit 170M

-Rob Feature
Geeks and God Co-Host
www.mustardseedmedia.com

Dreamhost has generic

Dreamhost has generic instructions for modding php.ini on their wiki: http://wiki.dreamhost.com/inde...

You'll need an SSH client like Putty: http://www.chiark.greenend.org...

I never thought about changing upload size in .htaccess.

htaccess again

I could be wrong, but I'm not sure that memory_limit has to be cranked that high for this to work. I've uploaded some pretty hefty files this way and my memory_limit is still only set to 32M. Somewhere along the line I read that you have to set at least one of the parameters to be twice the size of the files you'll want to upload. I'm guessing from Rob's example it's the post_max_size. I just set both of mine to 200M, but I don't expect to be uploading files greater than 100M in size.

Micah

From The PHP Handbook

According to the PHP handbook, "Generally speaking, memory_limit should be larger than post_max_size." You'll notice that memory_limit is about the size for the max post plus a running drupal install.

Matt Farina
Geeks and God Co-Host
www.innovatingtomorrow.net
www.mattfarina.com

memory_limit

Just a quick survey. What do folks use as their starting memory limit for PHP5 driven Drupal sites?

16M

I use 16 Meg for mine. That's the default, I think, with PHP5. Of course, take into consideration that I use APC on everything so a drupal site with a boat load of modules rarely breaks 4M of memory. So, my numbers are totally useless for most people.

Matt Farina
Geeks and God Co-Host
www.innovatingtomorrow.net
www.mattfarina.com

32MB

I have been starting at 32MB. Thanks for the info Matt.

I have used eaccelerator, but would love to know more about APC. What made you pick APC over other solutions? Do you have a good set of install instructions on the web that would be good for me to check out?

Thanks!
Shrop

APC support

APC seems to have the best support behind it and that's why I choose it. Rasmus, the origional creator of PHP, is one of the guys who works on APC and is behind it. It's the most well maintained of the op code caches.

I wrote up a tutorial for installing it on a media temple dv which could be adapted for other places. it's at http://www.innovatingtomorrow....

Matt Farina
Geeks and God Co-Host
www.innovatingtomorrow.net
www.mattfarina.com

Thanks Matt! I will check

Thanks Matt! I will check out your article. I had some issues with eaccelerator and Drupal. May have been cause I was running php4 last year. Not sure.

Shrop

ImageCache wants 96M

I just noticed today in my status report that ImageCache 5.x-2.0 recommends 96M.

Quoting directly from /admin/logs/status:

It is highly recommended that you set you PHP memory_limit to 96M to use imagecache. A 1600x1200 images consumes ~45M of memory when decompressed and there are instances where ImageCache is operating on two decompressed images at once.

Micah

thanks!

I have missed that one.. certainly limits the number of Drupal sites on one host. Good to know.

Thanks!
Shrop