Forum Moderators: coopster
In php.ini:
file_uploads = Off upload_max_filesize = 2M In httpd.conf:
<Directory "/some/dir"> AllowOverride All </Directory> In "/some/dir" .htaccess (chmod 644):
php_flag file_uploads on php_value upload_max_filesize 4M The result:
file_uploads = Off within "/some/dir/" upload_max_filesize = 4M within "/some/dir/" I've tried:
<Directory "/some/dir"> AllowOverride All php_flag file_uploads on </Directory> in httpd.conf, and:
<IfModule mod_php5.c> php_flag file_uploads on </IfModule> in both httpd.conf and .htaccess, but I just can't get
file_uploads enabled on a PERDIR basis. Also tried
php_flag file_uploads 1 and php_flag file_uploads "1" and php_value file_uploads "On" in all of the above scenarios with no joy. Does PHP v.5.x never allow file_uploads on a PERDIR basis? I noted in the docs that it was allowable on a SYSTEM basis, which is why I figured I'd try the httpd.conf hack, to no avail.
What am I missing, here? TIA.
php_flag file_uploads onis it. Yes, as of PHP > 4.2.3 it must be set in either
php.inior
httpd.conf. It cannot be overridden in per-directory override files (
.htaccess).
Make sure you don't have other overrides in your configuration file(s) that are not allowing otherwise (are you using some type of control panel?)
Also, don't forget to restart Apache or the configuration file is not going to be in effect.
Got the answer, amusingly enough from a closer reading of the PHP manual [php.net]! (doh)
php_flag name onŠoff
Used to set a boolean configuration directive. Can be used only with PHP_INI_ALL and PHP_INI_PERDIR type directives.
Since
file_uploads is a PHP_INI_SYSTEM type directive as of PHP v.5.x, I needed to use these in my httpd.conf file: <Directory "/some/dir"> [b]php_admin_flag[/b] file_uploads on php_value upload_max_filesize 4M </Directory> (Not allowed to use PHP_INI_SYSTEM type directives in .htaccess files, just in php.ini or httpd.conf, as you noted.)
After a restart, I'm all set and allowing file uploads with a greater filesize limit than set in php.ini on a per-directory basis.
Thanks again!
[edited by: StupidScript at 9:09 pm (utc) on Aug. 3, 2006]