I developped image upload feature under Windows and it was working fine. Before deploying to a remote Ubuntu server, I installed an ubuntu image mimicking the production environement using VirtualBox, everything is working fine except that the image upload request is returning 500 internal server problem.
When I visited my log file:
Request.critical: uncaught php exception runtimeException could not create target directory to move temporary file into at ... uploadFileMover.php at line 22
The PHP code around that line:
$targetDir = $uploadBasePath . DIRECTORY_SEPARATOR . $relativePath;
if (!is_dir($targetDir)) {
$ret = mkdir($targetDir, umask(), true);
if (!$ret) {
throw new \RuntimeException("Could not create target directory to move temporary file into.");
}
}
Could you please tell me what could be reasons behind. Your help is appreciated
Edit:
Based on Nehal comment, I set folders permission to rwX for , to no avail. Here is what getfacl
gives me for all folders and subfolders of /web/
(web
, web/uploads
, web/uploads/2016/
...)
# file :web
# user: ubuntu
# group :ubuntu
user::rwx
user:www-data:rwx
group::rwx
mask::rwx
other::r-x
default:user::rwx
default:user:www-data:rwx
default:group::rwx
default:mask::rwx
default:other::r-x
# file :web/uploads
# user: ubuntu
# group :ubuntu
user::rwx
user:www-data:rwx
group::rwx
mask::rwx
other::r-x
default:user::rwx
default:user:www-data:rwx
default:group::rwx
default:mask::rwx
default:other::r-x