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..
Related
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 need to use time zone PST for my application, so i have set these settings in .htaccess file of my zend project. --
php_value date.timezone "America/Los_Angeles"
But it is not being reflected in my project, when i echo the date it is showing me Indian time. What am missing in this please help me to know.
Ensure .htaccess files is of any use. It may be that your httpd is not even reading it (most likely) or it does, but ignores your php_value (less possible as it usually ends with error 500)
My php script that uploads files in my centos - apache server was working fine.
Today I enabled suphp in server and after that script is not uploading any files.
I was used "php_flag register_globals on" in .htaccess before. But I removed that line from ".htaccess" in order to prevent 500 server error.
Pls help
After a long search and testing, I found the solution myself.
Just created a php.ini file and added a line:
register_global = on
and removed all php flags in .htaccess.
Now its working fine.
As you figured out the parameter has to be in a php.ini file and suPHP has to be instructed to read this file. More information in this answer: php.ini not being read (Debian / ISP Config)
But; If your upload script requires register_globals to be enabled it's probably badly written or outdated. You should try to avoid using register_globals since it poses a security threat. More about that here: What are register_globals in PHP?
I know there are a lot of questions on here about this, but most of them seem to be from people who don't know that 'memory_limit', 'post_max_size', and 'upload_max_filesize' are PHP_INI_PERDIR (i.e. they can't be changed using ini_set()). I already learned that the hard way.
However, everything indicates that I should be able to change them using a .htaccess file—everything, that is, except my actual experience.
Here are the contents of my .htaccess file:
# Allow large file uploads
php_value memory_limit 4294967296
php_value post_max_size 1073741824
php_value upload_max_filesize 524288000
I've tried a number of different combinations, but none of them seem to have any effect on anything. I know I've gotta be missing something, but I can't for the life of me figure out what that something is.
P.S. I'm running PHP 5.2.4 locally on Mac OS X 10.4 from entropy.ch.
You need to permit those settings to be changed in a .htaccess file. For that, you need AllowOverride Options or AllowOverride All in a relevant section your httpd.conf file (in a <Directory> block for that directory or a parent thereof).
Note also this will only work if you're using Apache and mod_php5 (i.e., no CGI/FastCGI/whatever).
See also the manual.
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.