Reputation: 4538
I'm trying to change the size limit of an upload. I know I have to change those directive, in Apache configuration (some can't be changed using ini_set)
php_value session.gc_maxlifetime 3600
php_value max_input_time 3600
php_value max_execution_time 3600
php_value upload_max_filesize 10M
php_value post_max_size 110M
Unfortunately, I can't do that directly in a <Directory>
of my virtualhost, since the directory is always the same (I'm using a front controller, thus all request go through index.php & are dispatched to the proper controller - I use Symfony)
My question, then, is how can I avoid this problem ? I don't want to set those values for the whole application, only for a specific action.
Upvotes: 4
Views: 1019
Reputation: 7157
This is possible, depending on how you map to your front controller. If you're doing it via rewrite rules then you can use a <Location>
instead of <Directory>
block to specify a chunk of path you want to change the settings for. <LocationMatch>
lets you use a regexp for the same thing.
If all of your external URLs really start with /index.php?
then consider setting up a redirect rule especially for these requests:
RewriteEngine on
RewriteRule ^foo/$ ^/index.php [L]
<Location /foo/>
php_value ...
</Location>
If that's not the case, you'll need to tell us more about your application structure.
Upvotes: 2
Reputation: 437664
A possible workaround would be to create a directory with a single PHP file inside that implements your action and have the script that submits the POST target that file using a "custom" URL. After processing the input you would redirect back to a normal page through index.php
. It's not clean, but it should work.
It could also be worth considering what exactly you stand to gain from this.
session.gc_maxlifetime
in just one action (especially if you are increasing it)max_input_time
to one hour also does not make sense if max_execution_time
is also one hourmax_execution_time
can be set at runtimeSo, what's the aim here?
Upvotes: 1