 |
 |
How do I set the max filesize of an upload in Apache/php?
|
 |
|
 |
|
Mac Enthusiast
Join Date: May 2001
Status:
Offline
|
|
Hi,
I'm just trying to work with http://www.phpxplorer.org/phpXplorer/webIndex.php
I have the thing working just fine except that I can't upload any files larger than 2mb.
I have searched for php.ini and found a number of files containing that name. I have changed upload_max_filesize and post_max_size to 100M *in all of them*
*Still* I can't upload a file larger than 2mb.
I have read that Apache also has a restriction set in htaccess. I don't seem to have such a file.
What do I do? (This is my server)
Thanks! :-)
Simon
|
|
Get a free email address at http://www.ippimail.com and support your favorite charity without it costing you a penny.Email for the good guys!
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Dec 2002
Status:
Offline
|
|
htaccess files are for modifying the settings in /etc/httpd.conf in a specific folder. By this I mean a setting in httpd.conf can be overridden in your user directory by a creating ~/.htaccess and adding the setting to the file. So, what this means to you is either a) create a .htaccess file in the directory you want the setting to be changed or b) edit your httpd.conf file to change the setting.
|
|
Travis Sanderson
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Jan 1999
Location: Marietta, GA, USA
Status:
Offline
|
|
|
|
Scott Genevish
scott AT genevish DOT org
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: May 2001
Location: Vancouver
Status:
Offline
|
|
Might be stating the obvious, but did you restart the webserver after you made the changes? Any changes to php.ini will not be read in until after that restart.
Originally posted by simonmartin:
Hi,
I'm just trying to work with http://www.phpxplorer.org/phpXplorer/webIndex.php
I have the thing working just fine except that I can't upload any files larger than 2mb.
I have searched for php.ini and found a number of files containing that name. I have changed upload_max_filesize and post_max_size to 100M *in all of them*
*Still* I can't upload a file larger than 2mb.
I have read that Apache also has a restriction set in htaccess. I don't seem to have such a file.
What do I do? (This is my server)
Thanks! :-)
Simon
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: May 2001
Status:
Offline
|
|
Originally posted by redJag:
htaccess files are for modifying the settings in /etc/httpd.conf in a specific folder. By this I mean a setting in httpd.conf can be overridden in your user directory by a creating ~/.htaccess and adding the setting to the file. So, what this means to you is either a) create a .htaccess file in the directory you want the setting to be changed or b) edit your httpd.conf file to change the setting.
redJag,
Ok, so I need to create an .htaccess file in the relevant directory but how should the file look exactly? What are the commands relating to file uploads?
Say I wanted to allow uploads of 100MB...
I can't see anything relating to max uploads in httpd.conf...
Simon
(Last edited by simonmartin; Mar 15, 2005 at 03:56 PM.
)
|
|
Get a free email address at http://www.ippimail.com and support your favorite charity without it costing you a penny.Email for the good guys!
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: May 2001
Status:
Offline
|
|
Originally posted by legacyb4:
Might be stating the obvious, but did you restart the webserver after you made the changes? Any changes to php.ini will not be read in until after that restart.
legacyb4,
I did remember to restart
Simon
|
|
Get a free email address at http://www.ippimail.com and support your favorite charity without it costing you a penny.Email for the good guys!
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: May 2001
Status:
Offline
|
|
genevish,
I'm assuming phpxplorer doesn't set a limit to uploaded files...
The error I get makes reference to the php.ini file but I seem to have made the relevant changes there.
The error is: Could not upload file. Check your php.ini (upload_max_filesize) or talk to your provider.(max. 2M)
(Which one of the three ini files is the one I should be working on anyway...?)
Simon
(Last edited by simonmartin; Mar 15, 2005 at 04:16 PM.
)
|
|
Get a free email address at http://www.ippimail.com and support your favorite charity without it costing you a penny.Email for the good guys!
|
| |
|
|
|
 |
|
 |
|
Grizzled Veteran
Join Date: Jun 2001
Location: Melbourne, Australia
Status:
Offline
|
|
OK... take it back a step...
You don't necessarily need to create .htaccess files all over the place or even modify httpd.conf - what you did with php.ini should be enough.
Have you performed a phpinfo() from a test page? Check to see that the php.ini file is actually the one you modified, and scroll down the page to find the values for max_upload_size and max_post to ensure they're at the correct value. You can simply enter the value '100M' if you want a huge upload size (although there's an open invitation to tie up your server bandwidth!)
If you could post an extract of the phpinfo output (NOT the whole thing) then it may be easier to determine your problem.
|
|
Computer thez nohhh...
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: May 2001
Status:
Offline
|
|
Originally posted by Simon Mundy:
OK... take it back a step...
You don't necessarily need to create .htaccess files all over the place or even modify httpd.conf - what you did with php.ini should be enough.
Have you performed a phpinfo() from a test page? Check to see that the php.ini file is actually the one you modified, and scroll down the page to find the values for max_upload_size and max_post to ensure they're at the correct value. You can simply enter the value '100M' if you want a huge upload size (although there's an open invitation to tie up your server bandwidth!)
If you could post an extract of the phpinfo output (NOT the whole thing) then it may be easier to determine your problem.
Simon,
I don't follow this...
My test file shows me this:
Configuration File (php.ini) Path /etc
post_max_size 8M
upload_max_filesize 2M
Obviously I haven't edited the right php.ini file.
The only php.ini file I have in /etc is named php.ini.default, which I *have* edited.
Which php.ini file am I supposed to be editing?
Simon
|
|
Get a free email address at http://www.ippimail.com and support your favorite charity without it costing you a penny.Email for the good guys!
|
| |
|
|
|
 |
|
 |
|
Grizzled Veteran
Join Date: Jun 2001
Location: Melbourne, Australia
Status:
Offline
|
|
Originally posted by simonmartin:
Simon,
I don't follow this...
My test file shows me this:
Configuration File (php.ini) Path /etc
post_max_size 8M
upload_max_filesize 2M
Obviously I haven't edited the right php.ini file.
The only php.ini file I have in /etc is named php.ini.default, which I *have* edited.
Which php.ini file am I supposed to be editing?
Simon
It was the right file with the WRONG name!
The suffix '.default' means that these are the default settings that PHP will use. However, it is still looking for a file called 'php.ini' - all you need to do is rename that file to php.ini and restart apache and you're in business.
|
|
Computer thez nohhh...
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: May 2001
Status:
Offline
|
|
Originally posted by Simon Mundy:
It was the right file with the WRONG name! 
The suffix '.default' means that these are the default settings that PHP will use. However, it is still looking for a file called 'php.ini' - all you need to do is rename that file to php.ini and restart apache and you're in business.
Simon,
Yessss!
Thanks mate. Sorted.
Two questions though:
1) Is it usual to have a 'mis-named' php.ini file like that?
2) I have been told that I should increase the memory limit for each process from 8M if I need to upload larger files.
What do you recommend here? I would have thought that 100mb uploads would be all I need.
Thanks again
Simon
|
|
Get a free email address at http://www.ippimail.com and support your favorite charity without it costing you a penny.Email for the good guys!
|
| |
|
|
|
 |
|
 |
|
Grizzled Veteran
Join Date: Jun 2001
Location: Melbourne, Australia
Status:
Offline
|
|
1) Is it usual to have a 'mis-named' php.ini file like that?
2) I have been told that I should increase the memory limit for each process from 8M if I need to upload larger files.
I have to say that 100Mb uploads is pretty excessive - I certainly wouldn't want my web users uploading files like that on a regular basis in case it chewed up all my server bandwidth, but that's for you to decide. I keep it down to ~10Mb which is a fairly generous allowance in my books.
Upping the memory limit for PHP really depends on whether your server has enough memory to cope with running several processes at once - if you have 512Mb then perhaps 8-12 is all you can work with, but a machine with 1 - 2Gb you could probably increase the memory limit to 32Mb. Of course, you have to keep an eye on things and work out which processes would actually cause PHP to require such a memory consumption. The GD library is one instance where I found it helps to allocate around 32Mb to be useful processing larger files.
The 'default' php file is placed in your /etc folder by the installer in most cases. It's there for you to take a copy from and to tweak the settings to your hearts content. Usually the php.ini-recommended is the one you can use because it has settings that have been selected for a good deal of security on a public server.
|
|
Computer thez nohhh...
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: May 2001
Status:
Offline
|
|
Originally posted by Simon Mundy:
1) Is it usual to have a 'mis-named' php.ini file like that?
2) I have been told that I should increase the memory limit for each process from 8M if I need to upload larger files.
I have to say that 100Mb uploads is pretty excessive - I certainly wouldn't want my web users uploading files like that on a regular basis in case it chewed up all my server bandwidth, but that's for you to decide. I keep it down to ~10Mb which is a fairly generous allowance in my books.
Upping the memory limit for PHP really depends on whether your server has enough memory to cope with running several processes at once - if you have 512Mb then perhaps 8-12 is all you can work with, but a machine with 1 - 2Gb you could probably increase the memory limit to 32Mb. Of course, you have to keep an eye on things and work out which processes would actually cause PHP to require such a memory consumption. The GD library is one instance where I found it helps to allocate around 32Mb to be useful processing larger files.
The 'default' php file is placed in your /etc folder by the installer in most cases. It's there for you to take a copy from and to tweak the settings to your hearts content. Usually the php.ini-recommended is the one you can use because it has settings that have been selected for a good deal of security on a public server.
Simon,
This is a very low volume server for clients who can't access by ftp.
The server has 1.5gb RAM so I might up the setting to 32mb.
How do I set the memory limit for the 'GD library' you mention...?
I see what you are sayng about the original php.ini file, thanks for that.
Simon
|
|
Get a free email address at http://www.ippimail.com and support your favorite charity without it costing you a penny.Email for the good guys!
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|