Allow file uploads larger than the default 8 megabytes and secure php.ini file
by kalai[ Edit ] 2008-03-11 12:16:06
To allow file uploads larger than the default 8 megabytes, put these settings in your /etc/php.ini:
post_max_size = 16M
upload_max_filesize = 16M
You can check phpinfo() output to make sure that those values get set correctly.
Also make sure that your script does not have an html form input tag for MAX_FILE_SIZE that is smaller (in bytes) than the size of the files that you are trying to upload.
Now you will be able to upload files up to 16 megabytes.
secure php.ini file
we don't want the outside world to have access to your settings in your php.ini file. The solution? Drop an .htaccess file in the same directory with the following lines in it:
<Files ~ "^.*.ini">
Deny From All
</Files>
This will deny any web requests to any file in that directory ending in .ini; thus preventing your PHP settings from being seen by others.
Now you have a secure php.ini file that you can modify settings in to affect the .php files within that directory.