Need ability to set configuration options using single method which will work across multiple server configurations.

Posted by JMC Creative on Server Fault See other posts from Server Fault or by JMC Creative
Published on 2010-12-29T16:19:13Z Indexed on 2010/12/29 16:55 UTC
Read the original article Hit count: 152

Filed under:
|
|

I'm trying to set post_max_size and upload_max_filesize in a specific directory for a web application I'm building. I've tried the following in a .htaccess file in the script directory. (upload.php is the script that needs the special configuration)

<Files upload.php>
    php_value upload_max_filesize 9998M
    php_value post_max_size 9999M
</Files>

That doesn't work at all. I've tried it without the scriptname specificity, where the only thing in the .htaccess file is:

php_value upload_max_filesize 9998M
php_value post_max_size 9999M

This works on my pc-based xampp server, but throws a "500 Misconfiguration Error" on my production server. I've tried also creating a php.ini file in the directory with:

post_max_size = 9999M
upload_max_filesize = 9998M

But this also doesn't always work. And lastly using the following in the php script doesn't work either, supposedly because the settings have already been compiled by the time the parser reaches the line (?):

<?php 
ini_set('post_max_size','9999M');
ini_set('upload_max_filesize','9998M');
?>

© Server Fault or respective owner

Related posts about apache

Related posts about .htaccess