500 Internal error, Failed upload file...
joglomedia opened this issue · comments
An 500 internal server error produced when uploading file, error from the log show:
2019/09/24 23:03:03 [error] 28295#28295: *348 FastCGI sent in stderr: "PHP message: PHP Warning: Unknown: open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): (/home/lemper) in Unknown on line 0PHP message: PHP Warning: File upload error - unable to create a temporary file in Unknown on line 0" while reading response header from upstream, client: 36.90.208.58, server: lapak.store, request: "POST /wp-admin/network/update.php?action=upload-theme HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.3-fpm.lemper.sock:", host: "lapak.store", referrer: "http://lapak.store/wp-admin/network/theme-install.php?browse=featured"
2019/09/24 23:10:40 [error] 29018#29018: *400 FastCGI sent in stderr: "PHP message: PHP Notice: Unknown: file created in the system's temporary directory in Unknown on line 0PHP message: PHP Warning: Unknown: open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): (/home/lemper) in Unknown on line 0PHP message: PHP Warning: File upload error - unable to create a temporary file in Unknown on line 0" while reading response header from upstream, client: 36.90.208.58, server: lapak.store, request: "POST /wp-admin/network/update.php?action=upload-theme HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.3-fpm.lemper.sock:", host: "lapak.store", referrer: "http://lapak.store/wp-admin/network/theme-install.php?browse=featured"
it is due to open_basedir setting
possible solutione here https://mediatemple.net/community/products/dv/204644200/how-do-i-set-the-upload_tmp_dir
- Move /tmp directory to open_basedir directory, utilizing upload_tmp_dir
php_admin_value[upload_tmp_dir] = /home/lemper/tmp
add to the respective PHP FPM user pool configuration. - Automate /tmp directory creation during user pool created.
- Restart php fpm service daemon