• 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

httpd.include help

I

its_genetic

Guest
ok im trying to get my server to allow uploads larger then 2mb. ive configured the php.ini file, but that i guess isnt enough.

so basically i have to edit

/home/httpd/vhosts/{domain_name}/conf/httpd.include

and add the lines:
php_admin_value post_max_size 60M
php_admin_value upload_max_filesize 60M

but i dont want to do this for every domain i create, does anyone know where i can add the 2 lines of code so i dont have to do it to each account?
 
If you want it to be server wide, change the following values in /etc/php.ini

upload_max_filesize = 2M ; Maximum allowed size for uploaded files.
max_execution_time = 30 ; Maximum execution time of each script, in seconds
memory_limit = 32M
post_max_size = 8M ; Maximum size of POST data that PHP will accept. Too large causes errors

If you are using a PHP upload script, then you need to increase the max_execution_time
 
ive done that. but i still have a problem uploading large files. Thats when i realized that i need to add it to the domain httpd.include

when i add the 2 lines of code to the httpd.include it works
 
Interesting. If you put it into the global /etc/php.ini file and then restart apache, it should take effect for all domains, without having to necessarily put it into the domain specific httpd.include file.

Oh, wait! When you edited the php.ini file, you didn't put the 'php_admin_value' part right? In the php.ini file, you only need the 'variable name = value' part.

The 'php_admin_value' portion is only needed when you put things in httpd.conf/include, vhost.conf/vhost_ssl.conf/ and .htaccess files...
 
yup

correct. But now im noticing that when i add a new domain. it resets all of the httpd.include to the default setting. So the 2 variables that i added are now missing.

so im still open to suggestions.
 
Editing php.ini is enough, guaranteed. Just change the default relevant lines.
 
Seriously i tried that and its not working.

ive even crossed checked it with phpinfo.php on 2 accounts.

account 1 has the fix in the httpd.index where the upload_max_filesize (local value) = 60mb and master = 2mb

on account 2 i created a new domain and checked that the upload_max_filesize (local value) = 2mb and master value = 2 mb

Then of course the other problem is making sure the httpd.index isn't over written when changes are made to the account.

so my guess is to change the master value but, where is it?
 
httpd.include files will be overwritten by Plesk whenever you make changes to domains in the control panel. You are supposed to put your custom settings into the domain's vhost.conf or vhost_ssl.conf files.

The master or global values are in the /etc/php.ini file. Always restart Apache after making changes.

If you used a Windows based editor to change the /etc/php.ini file and then re-uploaded it, you will have to run the following commands:

cd /etc
dos2unix php.ini
service httpd restart

This will strip the Windows CR's (^M) from the file. When editing Linux files, it is best to use a Linux compatible editor.

Linux does not like having ^M characters in it's files. This is a very common problem with newbies to Linux.
 
well im using linux, im on 7.5.3, ive edited the master file (php.ini) and its not changing. Ive restarted apache plenty of times and ive rebooted.

Local Value Master Value
allow_call_time_pass_reference Off Off
allow_url_fopen On On
always_populate_raw_post_data Off Off
arg_separator.input & &
arg_separator.output & &
asp_tags Off Off
auto_append_file no value no value
auto_prepend_file no value no value
browscap no value no value
default_charset no value no value
default_mimetype text/html text/html
define_syslog_variables Off Off
disable_classes no value no value
disable_functions no value no value
display_errors On On
display_startup_errors Off Off
doc_root no value no value
docref_ext no value no value
docref_root no value no value
enable_dl On On
error_append_string no value no value
error_log no value no value
error_prepend_string no value no value
error_reporting no value no value
expose_php On On
extension_dir /usr/lib/php4 /usr/lib/php4
file_uploads On On
gpc_order GPC GPC
highlight.bg #FFFFFF #FFFFFF
highlight.comment #FF8000 #FF8000
highlight.default #0000BB #0000BB
highlight.html #000000 #000000
highlight.keyword #007700 #007700
highlight.string #DD0000 #DD0000
html_errors On On
ignore_repeated_errors Off Off
ignore_repeated_source Off Off
ignore_user_abort Off Off
implicit_flush Off Off
include_path .:/usr/share/pear .:/usr/share/pear
log_errors Off Off
log_errors_max_len 1024 1024
magic_quotes_gpc On On
magic_quotes_runtime Off Off
magic_quotes_sybase Off Off
max_execution_time 3600 3600
max_input_time 1800 1800
memory_limit 50M 50M
open_basedir /home/httpd/vhosts/xxxxxxx.org/httpdocs:/tmp no value
output_buffering no value no value
output_handler no value no value
post_max_size 8M 8M
precision 14 14
register_argc_argv On On
register_globals Off Off
report_memleaks On On
safe_mode Off Off
safe_mode_exec_dir no value no value
safe_mode_gid Off Off
safe_mode_include_dir no value no value
sendmail_from no value no value
sendmail_path /usr/sbin/sendmail -t -i /usr/sbin/sendmail -t -i
serialize_precision 100 100
short_open_tag On On
SMTP localhost localhost
smtp_port 25 25
sql.safe_mode Off Off
track_errors Off Off
unserialize_callback_func no value no value
upload_max_filesize 2M 2M
upload_tmp_dir no value no value
user_dir no value no value
variables_order no value no value
xmlrpc_error_number 0 0
xmlrpc_errors Off Off
y2k_compliance On On
 
I'm not going to argue, I believe you have tried modifying the /etc/php.ini file (which is the global changes file). For whatever reason, it's not working for you.

So your alternative is to create (or edit existing) the following files:

/home/httpd/vhosts/{domain_name}/conf/vhost.conf

<Directory /home/httpd/vhosts/yourdomain.org/httpdocs>
php_admin_value post_max_size 60M
php_admin_value upload_max_filesize 60M
</Directory>

/home/httpd/vhosts/{domain_name}/conf/vhost_ssl.conf

<Directory /home/httpd/vhosts/yourdomain.org/httpsdocs>
php_admin_value post_max_size 60M
php_admin_value upload_max_filesize 60M
</Directory>
You can create both, or just one or the other depending on if you need the same options for SSL and non-SSL sites. These files will not be overwritten by Plesk upon making domain changes.

You can create a skeleton file and use it so that all newly created domains will also have these vhost/vhost_ssl conf files upon creation. The file will look the same, but replace 'yourdomain.org' with '@domain_name@' (double check the docs, I think this was the right tag)
 
thank you fro your help BTW. Where are the skeleton files located?
 
The pre-defined ones which Plesk uses are located at:

/home/httpd/vhosts/.skel/0/httpdocs (non-SSL) and
/home/httpd/vhosts/.skel/0/httpsdocs (SSL)

Normally you would create your own (read the docs/admin manual), tar/zip them up and use the control panel to 'upload' them, which would store them in a new numbered folder under the .skel directory. But I suppose you could just modify what they have there already...
 
Back
Top