How To Fix: FastCGI sent in stderr – PHP message: PHP Warning: move_uploaded_file

PHP Warning: move_uploaded_file It is a typical error of web servers with NGINX And it appears when we want to upload to a file on the server. Most of the time, when we have to upload some certificates or other files that do not “Media”, the error does not see it in the interface of administration of the CMS.

In a more concrete form, the error “PHP Warning: move_uploaded_file” we find it in error.log In the form:

FastCGI sent in stderr: "PHP message: PHP Warning:  move_uploaded_file(/srv/www/domain.test/public/file.file): failed to open stream: Permission denied in /srv/www/domain.test/public/script.php on line 748 PHP message: PHP Warning:  move_uploaded_file(): Unable to move '/tmp/phpqAVtWy'

Why does the error occur PHP Warning: move_uploaded_file and how we solve it

As I said above, the error appears when we try to upload files on the web server.

FastCGI sent in stderr” is typical for servers that have PHP-FPM and NGINX as a web software. So the problem is somewhere in the relationship of the script through which the files are uploaded.

move_uploaded_file(): Unable to move” It tells us very clearly that those files cannot be uploaded and moved to another folder on the web server by the script that performs the operation.

Solving this error PHP It is solved very simply, setting on the server the correct permissions, both for the execution script, to which most likely user: NGINX did not have access, as well as for the destination folder.

If the website files do not belong to a user, as it is on CPanel, Vestacp or other hosting management platforms, then it is almost certainly solving it is to give the NGINX user access to the upload folder and the script.

For the example of the code above, we will execute the following order in SSH:

chown -R nginx:nginx /srv/www/domain.test/public/
chmod g+w file.file

We resume upload and everything should go without the error move_uploaded_file(): Unable to move.

If you continue to have problems, it can be solved in the comments from this tutorial.

Passionate about technology, I write with pleasure on stealthsetts.com starting with 2006. I have a rich experience in operating systems: Macos, Windows and Linux, but also in programming languages ​​and blogging platforms (WordPress) and for online stores (WooCommerce, Magento, Presashop).

Home Your source of IT tutorials, useful tips and news. How To Fix: FastCGI sent in stderr – PHP message: PHP Warning: move_uploaded_file

1 thought on “How To Fix: <span class="notranslate">FastCGI sent in stderr – PHP message: PHP Warning: move_uploaded_file</span>”

  1. Bonjour,
    I read and reread your articles on the subject [Move_upload_file].
    It turns out that I am confronted with this problem and that I have been looking for many months to get out of it without success.
    I have a personal site in which I have a page form.html which only works partially, namely: impossible to open the flow etc ... and of course to move it to ‘uploads’.
    I am retired from the graphic arts, typographer at 13, then an offset editor, graphic designer, webmaster, in short I am 84 years old retired and I am always and still passionate about my job.
    If I manage with HTML and JavaScript, I come up against PHP today.
    I do with my colleagues veterans in Algeria, small outings and realize “reports” that I put on my personal site available for those who are interested; So, I want to receive docs because I do not do everything myself to illustrate my words, hence the idea of ​​the form and PHP treatment.
    I created my site with "Dreamweaver CC2020", Mac version hosted at home on a Synology server "NGNIX" DMS v. 7.1 – PHP 8 (PEP PHP 7.2, PHP 7.3, PHP 7.4). CERFIFIED PAR DEFAULT (NO-IP): Trustcc DV ca – G2 RSA
    The form works properly for the “text” fields, but refuses the media fields.
    If you want, you can connect to the URL above, click on the figurine and as I have not activated the HTML "Back", you can view the result in the PHP page. (I allocated 10 Mb and 20 Mb) for the media.
    And if I am good to you, the concern would come from the “fastcgi” of the Nginx PHP-TPM servers which is my case, then in the TPM pane, there is many boxes to check or uncheck, but what?
    I noticed the SSH command:
    Chown -R nginx: nginx/SRV/www/domain.test/public/
    chmod g+w file.file
    But will it be suitable for my server?
    Thank you in advance for your precious advice

    Reply
Leave a Comment