I recently needed to increase the
post_max_size values to something higher than the measly amount set by a particular webhost's default php.ini file. This account was set up with cPanel and overriding the php.ini defaults the usual way (by adding various lines to the .htaccess or settings.php files) didn't work at all. If you've had the same experience, you may find that this how-to works for you.
This how-to is for any version of Drupal running on Linux and Apache. No Drupal modules are needed, but the devel module certainly helps.
1. Get and modify your custom php.ini file
It's best to use a php.ini file that somewhat resembles the one already running on your server. You can probably find one at /usr/local/lib/php.ini or /usr/local/Zend/etc/php.ini and just copy it into your account's web folder (it may be called "public_html" or "www" or "htdocs" -- you know the one).
2. Creating your CGI script
Now create a small script and put it in your cgi-bin directory. In your web folder, create another folder called "cgi-bin" if it's not there already. Using your preferred text editor, create a file name "php.cgi" and put the following into it:
exec /usr/local/cpanel/cgi-sys/php5 -c /path/to/drupal/
If you don't have cPanel on your account, try /etc/php5 instead. In any case, replace the /path/to/drupal/ part with the full path to your Drupal installation, such as /home/youraccount/public_html/ or /home/youraccount/public_html/drupal/
Since this is a script that needs to run as an executable file, use the chmod command and type this at the command line:
chmod -x php.cgi
Don't have shell access? That's outside the scope of this how-to, but you can use an FTP program that can change permissions of files, ask your webhost to make the php.cgi script executable for you, or make it executable with some PHP code (perhaps with the devel module's Execute PHP block).
3. Modifying your .htaccess file
Add this one line to your .htaccess file:
Action application/x-httpd-php5 /cgi-bin/php.cgi
This tells Apache to perform an action each time it encounters a file of file type "application/x-httpd-php5" -- if you're using a version of PHP older than PHP5, you'll need to change this to "application/x-httpd-php" (or upgrade to PHP5 -- ask your webhost).
Finally, scroll down to the part that says "# Protect files and directories from prying eyes" and add "
ini|" to the
<FilesMatch> directive so it looks something like:
<FilesMatch "(\.(ini|engine|inc|info|install|module|profile|po|sh|.*sql|theme|tpl(\.p hp)?|xtmpl)|code-style\.pl|Entries.*|Repository|Root|Tag|Template)$">
Notice the "
ini|" on the first line? This will prevent your custom php.ini file (and anything else ending in .ini) from being accessible to the entire world. (The character after the "ini" part is a pipe, by the way, not an L.)
4. Test your site
Load up your website and see if it works. If it does, good job! If it doesn't, go back to step 2 or 3 and check to see what version of PHP your site is using. You can also ask your webhost for help.
If you increased your
upload_max_size, then look at your
admin/settings/uploads admin page and see how big your uploads can be. If you increased your
memory_limit, check phpinfo or devel module's phpinfo() page at admin/logs/status/php