ronaldst
Chevereto Member
This is not a script bug, but it's a technical issue/server problem I can't seem to figure out. Hoping someone tech savy might be able to point me in the right direction here!
I am having problems uploading files when PHP-FPM (PHP 7.2) is active on my domain. Switching to PHP handler CGI works (PHP 7.2) fine, so I am assuming it has something to do with access to the default temp dir in the PHP-FPM configs.
EDIT/SOLUTION
After a few hours of sleep I managed to figure this one out. I'll post the solution in case any of you are running PHP-FPM. The error was due to not properly setting up open_basedir and upload_tmp_dir.
On my server I try to limit session and temp files within a user home directory, rather than using /tmp (which is a common security weaknesses in server setups). PHP-FPM is using .yaml files and is a bit different to configure than what I was used to.
This server setup is running Centos 7.x + WHM/cPanel w. Apache HTTP/2
Global settings (system_pool_defaults.yaml)
Remember to run rebuild PHP-FPM configs after doing changes
Doublecheck that Apache is restarted properly, and that changes are generated into the PHP-FPM user domain.tld.conf.
I am having problems uploading files when PHP-FPM (PHP 7.2) is active on my domain. Switching to PHP handler CGI works (PHP 7.2) fine, so I am assuming it has something to do with access to the default temp dir in the PHP-FPM configs.
EDIT/SOLUTION
After a few hours of sleep I managed to figure this one out. I'll post the solution in case any of you are running PHP-FPM. The error was due to not properly setting up open_basedir and upload_tmp_dir.
On my server I try to limit session and temp files within a user home directory, rather than using /tmp (which is a common security weaknesses in server setups). PHP-FPM is using .yaml files and is a bit different to configure than what I was used to.
This server setup is running Centos 7.x + WHM/cPanel w. Apache HTTP/2
Global settings (system_pool_defaults.yaml)
Code:
php_value_session_save_path: { name: 'php_value[session.save_path]', value: "/var/cpanel/php/sessions/[% ea_php_version %]" }
php_value_upload_tmp_dir: { name: 'php_value[upload_tmp_dir]', value: "[% homedir %]/tmp" }
php_value_open_basedir: { name: 'php_value[open_basedir]', value: "[% homedir %]" }
Remember to run rebuild PHP-FPM configs after doing changes
Code:
/scripts/php_fpm_config --rebuild
Doublecheck that Apache is restarted properly, and that changes are generated into the PHP-FPM user domain.tld.conf.
Last edited: