0

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');
?>
JakeParis
  • 123
  • 6

1 Answers1

0

I suspect your webhost doesn't allow custom PHP.ini settings. All the above methods will work on all "custom php.ini" enabled servers.

Contact your host to enable them (or) change the setting on your behalf.

Zypher
  • 37,405
  • 5
  • 53
  • 95
  • Well, I want this application to be portable to various server configurations. So contacting the host to solve the problem is not really a solution. – JakeParis Dec 29 '10 at 18:21
  • Ok. But without the help from host you cant enable "custom php.ini" file. Just as one time process, you should confirm your host, that custom php.ini is enabled or not. After you have turned on this future, you can use this in any number/type of applications. – S.Ragavendra Ganesh Jan 30 '11 at 01:05
  • Sorry, I guess I wasn't clear. I wanted the application to be portable to _other people's_ servers, which I will have no control over. – JakeParis Jan 30 '11 at 01:05
  • So, if they also block it, then what do you expect to do, exactly? – mfinni Jan 30 '11 at 01:05