upload permission denied in DataTables Editor

upload permission denied in DataTables Editor

johnugajohnuga Posts: 16Questions: 7Answers: 0
edited June 2016 in General

I am trying to implement the upload function and followed the online documentation. In the browser, after I attempt an upload, I see this:

A server error occurred while uploading the file

In the nginx error log, I see this:

*356 FastCGI sent in stderr: "PHP message: PHP Warning: move_uploaded_file(/var/www/public/client/upload/16.jpg): failed to open stream: Permission denied in /var/www/public/client/test1/associates/php/lib/Editor/Upload.php on line 457

PHP message: PHP Warning: move_uploaded_file(): Unable to move '/tmp/phpOkR4jq' to '/var/www/public/client/upload/16.jpg' in /var/www/public/client/test1/associates/php/lib/Editor/Upload.php on line 457" while reading response header from upstream, client: xxx, server: xxx, request: "POST /test1/associates/php/table.associates.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm/php-fpm.sock:", host: "xxx", referrer: "http://xxx/test1/associates/associates.php"

The permissions for /var/www/public/client/upload/ are 777 (also tried 755). The folder owner is nginx.

The upload entry is making it into my auxiliary SQL table, with the correct filename, file size, web_path and system_path.

Please help.

Thanks,
-John

Answers

  • johnugajohnuga Posts: 16Questions: 7Answers: 0

    The culprit was SELinux. Argh!!

    I adjusted SELinux and uploads are working OK now.

  • johnugajohnuga Posts: 16Questions: 7Answers: 0

    I was able to run these commands to get SELinux to work in enforcing mode and allow DataTables the permissions to write to the upload directory:

    semanage fcontext -a -t public_content_rw_t /var/www/public/client/upload/(/.*)?"
    restorecon -F -R -v /var/www/public/client/upload/
    setsebool -P allow_httpd_anon_write 1
    

    I hope this helps some one else!

    -John

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    Hi John,

    Thanks for posting back - great to hear you've got it working now.

    Regards,
    Allan

This discussion has been closed.