Hjem FAQs Uploads and php.ini
20 June 2024 - 15:37



Uploads and php.ini

PDF Print E-mail
Written by Trond   
Wednesday, 10 March 2010 19:26

If you have problems uploading files to your server, or if you have a problem with larger files, you may need to make som adjustments to the php.ini configuration.
Some hosts allow you to upload a php.ini file to your root folder. This is the prefered way to make the adjustments. If you can't use a local php.ini you can make the same changes in a apache .htaccess file.
Here you will find some info on the php.ini file.

You can download the php.ini at the bottom of this page.

The php.ini file contains all the configuration settings for your installation. Sometimes these setting might be overridden by directives in apache .htaccess files or even with in the scripts themselves but for the moment let's just concentrate on the ini file.

This file contains the following settings that we need to modify:

  • file_uploads
  • upload_max_filesize
  • max_input_time
  • memory_limit
  • max_execution_time
  • post_max_size

The first one is fairly obvious if you set this off, uploading is disabled for your installation. We will cover the rest of the configuration settings in detail below.

upload_max_filesize and post_max_size
Files are usually POSTed to the webserver in a format known as 'multipart/form-data'. The post_max_size sets the upper limit on the amount of data that a script can accept in this manner. Ideally this value should be larger than the value that you set for upload_max_filesize.

It's important to realize that upload_max_filesize is the sum of the sizes of all the files that you are uploading. post_max_size is the upload_max_filesize plus the sum of the lengths of all the other fields in the form plus any mime headers that the encoder might include. Since these fields are typically small you can often approximate the upload max size to the post max size.

According to the PHP documentation you can set a MAX_UPLOAD_LIMIT in your HTML form to suggest a limit to the browser. Our understanding is that browsers totally ignore this directive and the only solution that can impose such a client side restriction is Rad Upload Applet

When the PHP engine is handling an incoming POST it needs to keep some of the incoming data in memory. This directive has any effect only if you have used the --enable-memory-limit option at configuration time. Setting too high a value can be very dangerous because if several uploads are being handled concurrently all available memory will be used up and other unrelated scripts that consume a lot of memory might effect the whole server as well.

max_execution_time and max_input_time
These settings define the maximum life time of the script and the time that the script should spend in accepting input. If several mega bytes of data are being transfered max_input_time should be reasonably high. You can override the setting in the ini file for max_input_time by calling the set_time_limit() function in your scripts.

The php.ini you can download below is optimized for common Joomla! 1.0.x installations. If you use a picture gallery with huge images or videos, you may need to adjust the upload_max_filesize and post_max_size

In Joomla!: php.ini must be placed both in /root/ AND in /root/administrator/

Last Updated on Sunday, 16 May 2010 19:38
Discuss (0 posts)

You need to login or register to post comments.
Discuss this item on the forums. (0 posts)