• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Maximum file size for upload in single domain

K

kuhle

Guest
I would like to increase the maximum file size that can be uploaded for one particular domain. Can anyone tell me how to do it?

I know the php.ini file for the line that says:

; Maximum allowed size for uploaded files.
upload_max_filesize = 2M

... but this is server-wide, and I do not want to increase it to 100MB server-wide!!! Does anyone know if this can be set on a per domain basis?
 
Edit the vhost.conf file in the conf folder of the domain you want to change the upload size.

Add
<Directory /var/www/vhosts/<domain_name>/httpdocs>
php_admin_value upload_max_filesize [size_here]M
</Directory>

Then run:
/usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=<domain_name>

Regards,

Jay
 
Thanks for the help, but I am not sure that I have got this right.

I have looked in:
/home/httpd/vhosts/domain.com/conf

In there, I have created a file, with a single line:
php_admin_value upload_max_filesize 100M

but that does not seem to have done it.

I can't seem to find "the vhost.conf file in the conf folder of the domain you want to change" unless it was what I have done above.

Can you help further??
 
You need your <Directory /.....dir..here> and </Directory> tags before and after the vhost.conf file. This file, as mentioned in the previous posts, will be in the conf/ directory of your domain (You'll see httpd.include there already, do NOT modify it, add your own vhost.conf, add the lines you need, and issue the command he said for you to issue above.. you'll be done.).
 
Thank you both for your help.

The httpd.include file is at:
/home/httpd/vhosts/domain.com/conf

I did not amend that file at all.

In there, I have added the vhost.conf file which says:

<Directory /var/www/vhosts/domain.com/httpdocs>
php_admin_value upload_max_filesize 100M
</Directory>

I did not ave the <Directory ....> stuff before. I had only put the single line. Cross fingers it will be OK now!!

If any of that is wrong, please let me know. It will be tested today!!
 
Make sure to also adjust post_max_size (default 8M) and memory_limit (default 32M) in this case. If you set your upload_max_filesize to 100M you still won't be be able to upload a 100M file, as you can only post 8M.
 
Breun,

Thank you very much for that. Currently the file has the following, and if you could kindly tell me exactly what I have to add for the memory_limit, I would be really grateful ... sorry, I am not terribly technical!

-----------
# cat /home/httpd/vhosts/domain.com/conf/vhost.conf
<Directory /home/httpd/vhosts/domain.com/httpdocs>
php_admin_value upload_max_filesize 100M
php_admin_value post_max_size 100M
</Directory>
# /etc/init.d/httpd reload
Reloading httpd: [ OK ]
-----------

Thanks
 
You don't have to be technical, just search the docs.

http://www.php.net/ini.core#ini.file-uploads says:

"Whether or not to allow HTTP file uploads. See also the upload_max_filesize, upload_tmp_dir, and post_max_size directives. (...)"

That post_max_size link tells you:

"Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize.

If memory limit is enabled by your configure script, memory_limit also affects file uploading. Generally speaking, memory_limit should be larger than post_max_size. (...)"

So set memory_limit to something larger than 100M...
 
Answer...

I believe this might help some people...

I had tried unsuccessfully to add the following into the vhost.conf file:

<Directory /home/httpd/vhosts/domain.com/httpdocs>
php_admin_value upload_max_filesize 100M
php_admin_value post_max_size 100M
</Directory>

However, what I didn't realize is that you must have a line in your httpd.include file that includes the vhost.conf file in order for it to detect the settings, etc...

Everything works perfectly after I did the following:


1. Create the vhost.conf file in /home/httpd/vhosts/yourdomain.com/conf/ and add the lines of code that you want...

2. Go into your PLESK control panel and make a change to your domain 'setup' configuration... You can just choose to change something simple, and then change it back.

**This resets the httpd.include file, which will now show a line at the bottom: Include /home/httpd/vhosts/yourdomain.com/conf/vhost.conf

There is probably a shorter way to do step two, but this is the only way I know how to do it right now...

Basically, the httpd.include file automatically detects the vhost.conf file if it exists and includes it...

Hope this helps...

John
 
The normal/easy way to include your newly created vhost.conf files is to run /usr/local/psa/admin/bin/websrvmng -av.
 
Originally posted by jamxUK
Then run:
/usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=<domain_name>

That was covered previously.
 
You need your <Directory /.....dir..here> and </Directory> tags before and after the vhost.conf file. This file, as mentioned in the previous posts, will be in the conf/ directory of your domain (You'll see httpd.include there already, do NOT modify it, add your own vhost.conf, add the lines you need, and issue the command he said for you to issue above.. you'll be done.).
Worked great! Thank you. Plesk is awesome, and I thank you guys for providing such a powerful tool, that makes our lives a lot easier! Bravo! I have been a client for 2 years now, and will continue to be a client, and refer Plesk to anyone I know!
 
Back
Top