Under Linux (CentOS), files uploaded by PHP are particularly slow to execute the move_uploaded_file method.

the project came online yesterday, but I found that PHP was particularly slow to execute the move_uploaded_file method when uploading large files.
clipboard.png

KB
15MB10
"" ""
clipboard.png
clipboard.png

PHP.iniWindows


findLinuxphp.ini
php-fpmapache
cp 15MB.zip
chmod 777/chmod a+rwx






13:31
PHP
(YUM
yum -y install php72w php72w-cli php72w-common php72w-devel php72w-embedded php72w-fpm .....)
php-fpm.conf:

LinuxPHP

PHP

14.58
PHP-fpm
20
PHP
clipboard.png

15.48
PHP
Nginx
clipboard.png

Mar.31,2021

php-fpm.conf enable slowlog of php

Please do a test and create a new 20m file under the / tmp directory, and mv on linux to your uploaded PHP directory

< H1 > 4:00 update < / H1 >
  1. check slowlog permissions
  2. request_slowlog_timeout = 5 has no unit

< H1 > [update at 19:47] problem resolution < / H1 >

I am on the local server and change the test interface to the interface of the online server. It is found that the waiting time after upload is very short.
and I manually turn on the PHP interface of the online server is also very fast.
therefore, the idea of "there is something wrong with PHP" is rejected.

then I looked back at the Nginx configuration and changed the IP address to 127.0.0.1.


although there is still some Waiting time, it is basically negligible.
for more solutions to this Bug, you can use the keyword Baidu [Waiting (TTFB) nginx].

< H2 > it is believed that there is room for optimization (CDN, etc.). < / H2 >

the Bug that has plagued me for a day and a half has finally been solved.
finally, thank you very much, @ xialeistudio, for your reply. Although in the end, the cause of the problem was not found through php-fpm 's log.
but your answer is very helpful to me and deepens my understanding of PHP. Thank you!

  • Centos7 php7.1 installation composer error

    yum --enablerepo=remi,remi-php71 install composer :fastestmirror Loading mirror speeds from cached hostfile * base: ftp.sjtu.edu.cn * epel: fedora.cs.nctu.edu.tw * extras: mirrors.shu.edu.cn * updates: ftp.sjtu.edu.cn * webtatic: uk.repo.webtatic.com...

    May.31,2022
Menu