Home >Backend Development >PHP Tutorial >Record the processing process of a certain PHP background system where images cannot be uploaded

Record the processing process of a certain PHP background system where images cannot be uploaded

藏色散人
藏色散人forward
2021-12-13 15:03:103723browse

Problem

The business department reported that a certain background system cannot upload pictures.

Background situation

There is no operation and maintenance post, the pagoda panel used by the server is unified

Processing process

  • Get ready to go to the server (Pagoda panel background) and look at the error log. Enter your account number and password and press Enter. It will prompt that the login is successful and jump to the login page. I have changed several browsers (I have a browser that only Used to look at the production server) This is the case

  • ssh successfully logged in to the server, df -h At first glance, my dear, the system disk is 100% (the system disk is only 20G), the problem has been found

  • I am going to empty the recycle bin first, but there is nothing in the /www/Recycle_bin/ directory

  • Execute the du -h --max-depth=1 command in the root directory to see which folder takes up more space, the one in the /www/wwwlogs/ directory The nginx log occupies about 13G

  • I found several log files exceeding 1G and deleted them with rm -rf xxx.log. The login panel background is still the same as before. Same situation. df -h Found that the system disk is still 100% occupied, the file was deleted, and the space was not recovered

  • The reason is that when Linux deletes files, it only deletes the files in the system A pointer to the file. If there are still processes using the file, the file will always exist. You can use lsof | grep delete to find the corresponding process and then kill, or you can directly restart the corresponding service.

  • Execute the /etc/init.d/nginx reload command to reload the nginx service and find that the remaining space is normal and the test upload function is normal.

  • I did two things later, one was to clean up part of the request log, and the other was to create a task for regular log cleaning

Better way to delete

A better way to delete large files is echo '' > file.ext, which directly overwrites and writes.                                                                                                                                             #

The above is the detailed content of Record the processing process of a certain PHP background system where images cannot be uploaded. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:learnku.com. If there is any infringement, please contact admin@php.cn delete