[horde] IMP attachment upload limit with PHP-FPM and .user.ini
Admin Beckspaced
admin at beckspaced.com
Sun Sep 6 09:08:16 UTC 2026
Hello there :)
I recently migrated my mail server from openSUSE Leap 15.6 to openSUSE
Leap 16.0 and ran into a strange issue with attachment uploads in IMP.
My current setup is:
*
openSUSE Leap 16.0
*
PHP 8.4.24
*
Apache with proxy_fcgi and PHP-FPM
*
Horde: dev-FRAMEWORK_6_0 (1b16603)
*
IMP: dev-FRAMEWORK_6_0 (3852464)
*
Horde Core: 3.3.0
*
Horde Browser: 3.0.0
Horde is installed via Composer under:
|/srv/www/horde/httpdocs|
The active PHP-FPM configuration contained the PHP default:
|/etc/php8/fpm/php.ini: upload_max_filesize = 2M|
For the Horde installation I had a |.user.ini| in the web directory
containing:
|upload_max_filesize = 32M post_max_size = 40M memory_limit = 128M|
I verified with a PHP test script in the same web environment that PHP
reported these values from |.user.ini| correctly.
Nevertheless, IMP refused attachments larger than approximately 2 MB and
displayed:
|Your attachment(s) are too large and cannot be uploaded.|
IMP itself was configured with:
|$conf['compose']['link_attachments'] = false;
$conf['compose']['attach_size_limit'] = 0;
$conf['compose']['attach_count_limit'] = 0;|
According to IMP's |conf.xml|, |attach_size_limit = 0| means that there
is no IMP-specific total attachment size limit.
As a test I also explicitly set:
|$conf['compose']['attach_size_limit'] = 33554432;|
but this made no difference. IMP still rejected attachments larger than
approximately 2 MB.
I then looked at |Horde_Browser::allowFileUploads()|. As far as I
understand the code, the upload limit is determined from:
|ini_get('upload_max_filesize') ini_get('post_max_size')|
with the smaller value being returned.
What finally solved the problem was setting the limits directly in the
active PHP-FPM pool configuration:
|/etc/php8/fpm/php-fpm.d/www.conf|
|php_admin_value[upload_max_filesize] = 32M
php_admin_value[post_max_size] = 40M php_admin_value[memory_limit] = 128M|
After restarting PHP-FPM, IMP immediately accepted larger attachments. I
successfully tested uploads with attachments of 4.4 MB and 7.1 MB.
So the practical problem is solved, but I would like to understand the
reason for this behaviour.
The interesting point for me is that the PHP-FPM |php.ini| definitely
contained |upload_max_filesize = 2M|, while the |.user.ini| contained
|upload_max_filesize = 32M|. A PHP test script in the Horde web
environment reported the 32M value correctly, but IMP still behaved as
if the 2M value from the FPM |php.ini| was being used.
Only after setting the same 32M value as |php_admin_value| directly in
the FPM pool did IMP accept larger attachments.
Is there anything in IMP's dynamic attachment upload handling or in
|Horde_Browser::allowFileUploads()| that could explain why the
|.user.ini| value appeared to be effective in a PHP test script, but IMP
still behaved according to the 2M FPM default?
And is configuring these limits directly in the PHP-FPM pool the
recommended way to configure Horde/IMP when using Apache with
|proxy_fcgi| and PHP-FPM?
Thanks in advance for any hints or explanations.
Greetings
Becki
More information about the horde
mailing list