douguio0185 2016-08-04 04:43
浏览 45

无法将上载的文件写入Linux生产服务器上的磁盘

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
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 livecharts wpf piechart 属性
    • ¥20 数学建模,尽量用matlab回答,论文格式
    • ¥15 昨天挂载了一下u盘,然后拔了
    • ¥30 win from 窗口最大最小化,控件放大缩小,闪烁问题
    • ¥20 易康econgnition精度验证
    • ¥15 msix packaging tool打包问题
    • ¥28 微信小程序开发页面布局没问题,真机调试的时候页面布局就乱了
    • ¥15 python的qt5界面
    • ¥15 无线电能传输系统MATLAB仿真问题
    • ¥50 如何用脚本实现输入法的热键设置