I have a page which allows users to upload images.
It is returning a 500 error when the user tries to upload larger images though.
The following code...
<?php echo ini_get("upload_max_filesize");
echo ini_get("post_max_size");
echo ini_get("max_input_time");
echo ini_get("max_execution_time");
?>
...returns:
100M
100M
60
3600
I'm guessing from this that it's the max-input-time that's causing the problem as i've tested with files under 100mb but taking longer than 60 seconds to upload.
I don't have access with my host to the php.ini file, so can I override these settings? I've tried adding an htaccess file but I'm not sure I've put it in the correct place.
Put a .htaccess file in the root folder of your website (where your php script is) and add the following values:
php_value upload_max_filesize 100M
php_value post_max_size 100M
php_value max_execution_time 200
php_value max_input_time 200
Of course, you can put other size and time limits. That should work.
Setting up php ini directives depends on the nature of your service provider's configuration. Run a phpinfo() script to look at your configuration. If your provider is starting PHP using suPHP in a user UID context then it may look for a php.ini in the script's directory. This is how it works for my hosting provider.
Related
I am trying to upload the purity 3 template for joomla, I downloaded 4 filers from there homepage, an extention manager, this file i can upload. and T3 plugin, this i cannot upload, i recieve the following error when trying:
Error
There was an error uploading this file to the server.
Maximum PHP file upload size is too small: This is set in php.ini in both upload_max_filesize and post_max_size settings of your PHP settings (located in php.ini and/or .htaccess file).
Unable to find install package
without this plugin i cannot get the template to work, i recieve this error:
500 - T3 Plugin is not enabled
You may not be able to visit this page because of:
an out-of-date bookmark/favourite
a search engine that has an out-of-date listing for this site
a mistyped address
you have no access to this page
The requested resource was not found.
An error has occurred while processing your request.
Please try one of the following pages: Home Page
If difficulties persist, please contact the System Administrator of this site and report the error below..
T3 Plugin is not enabled
I have tried to change the .htaccess file by adding this:
php_value upload_max_filesize 10M
php_value post_max_size 20M
php_value memory_limit 32M
I cannot find the right php.ini file.
Can anyone help me?
This question already has answers here:
Kohana - controller specific .htaccess
(2 answers)
Closed 7 years ago.
Basically I'm not allowed to use PHP's ini_set function to increase upload file size for a formular.
Now I'm trying to change it via htaccess, which works but seems to have the effect that its increased in every controller/form/view.
How am I able to increase the post_max_size in only one special controller/form/view?
When I put the htaccess in the public folder where the index.php from ZEND is, it works, but then it works in every form/controller.
I was trying it with (food is my controller), but this wont work:
<FilesMatch "^(food)">
php_value post_max_size 200MB
</FilesMatch>
Instead of doing that in your main .htaccess file. Put the php vars in an .htaccess file in the same folder as the upload script.
php_value post_max_size 200M
php_value upload_max_filesize 200M
Note: You might need to include the max filesize too because both are needed to increase upload limit.
I have a upload script which allows uploads up to 2 GB. My apache2 server allowed only 8MB of post_max_size. Is there any solution to define such properties from the php.ini in the htaccess. The reason why i want it to get it worked like that? I just want to use such big post_max_size only for my application not for the whole apache2 server.
Any ideas?
You can set the upload_max_filesize property to whatever value you want within either php.ini, .htaccess, or even httpd.conf. If you are using PHP 5.3 above, you can also set this property in user.ini
you can try this in htaccess files:
php_value upload_max_filesize 100M
php_value post_max_size 100M
or you can create php.ini file in root folder of your project put these two lines
upload_max_filesize=100M
post_max_size=100M
I'm curently using PHP for uploading images to my server. But -obviously- there's a limit in filesize, and I can't modify the .htaccess file, and can't access the php.ini file..
What happens when I, for example, add:
php_value post_max_size 10100000
, and:
php_value upload_max_filesize 10000000
to the .htaccess file, I get error 500.. This error will stay until I put back the original .htaccess file..
Neither does making a new php.ini in my main folder, or using ini_set() in php help, so my question is: is there a way to upload bigger files without having to alter php.ini or .htaccess ?
thanks in advance,
Jeroen
If you cannot change those directives, there is not much you can do.
Maybe you could use some other language than PHP, for your upload components ?
Maybe a CGI written in Perl, for example -- there are still hosting services supporting those ; and they might not have the same limitations.
this is out of 32bit Linuy limit.
Try using
php_value upload_max_filesize 1500M
php_value post_max_size 1500M
Ok, I think I figured out what to do. I cannot use CGI or PERL on my host, so I got to stick to PHP, and thus I'm left with this memory_limit.. I don't know if ini_set() is enabled on my server, so I need to find a way not to overload the memory dedicated to each request..
What I'm planning to do, is giving every upload (and resize) request a new, fresh page.. So each upload will have it's own iframe!!
This worked in Chrome so far, will test it later for other browsers, as I don't know if post requests will be accepted for iframes in every browser..
I am attaching a file in a node in drupal using File Attachment. But it is not allowing me to upload a file greater than 1MB. I want to upload a file of 50MB. How to increase this size. Thanks in advance.
Add the below to the relevant php.ini file (recommended, if you have access). Note that for some hosts this is a system-wide setting. However, for hosts running PHP as a CGI script with suexec (for example) you may be able to put these directives in a php.ini file in your Drupal root directory.
upload_max_filesize = 50M
post_max_size = 50M
Add the below to your .htaccess file in your Drupal root directory.
php_value upload_max_filesize 50M
php_value post_max_size 50M
Apart the limit set by PHP, there is also a limit set by Drupal, which is per role. Once you changed the limit set by PHP, you should also change the limit set by Drupal, to get the desired effect.
"Administer » Site configuration » File uploads" ( /admin/settings/uploads ).
You can set Drupal limit per each role. The Drupal settings cannot be larger than those permitted by PHP, but may be smaller if you haven't updated them, so remember to check there also, after updating the php.ini.