Temporary file problem analysis solution by Apache 500 error _linux

Source: Internet
Author: User
Tags connection reset apache log

View Apache log, found to be mod_fcgid module exception, prompt "Connection reset by Peer:mod_fcgid:error reading data from FastCGI server", "premature End of script headers:index.php "," process/usr/... apache/cgi-bin exit (communication error, get unexpected signal 7 ", plainly PHP is the early termination of execution, no return header to exit.

I search on the internet based on these errors for a long time, has not found a satisfactory answer, and even been misled, thinking that the Mod_fcgid module configuration problem.

Before I found a workaround, I kept thinking that PHP was a bit slow recently, but at least it was running, stating that the configuration was OK, and that if you were to execute phpinfo (), the program would still be able to execute. Once again, I combed through the rules of error and found that the MVC framework with multiple include hints at 500 internal errors. Other simple programs can be run. What does that mean?! This means that PHP is no longer able to include files, why? Temporary files can only be moved when these resources are requested, and temporary files do not have extra space.

Run

Df-h

I found it.

FileSystem  Size  Used  avail use%  mounted on
/dev/sda1  6.8G  6.5G  17M  100%  /
...

The system master Directory/Bottom has been blown off.

So, look for large files

Find/-type f-size +300m

found that PHP plug-in Xdebug produced a lot of performance analysis files, and are in the 100M record.

/tmp/profiler/cachegrind.out.1336
/tmp/profiler/cachegrind.out.1329 ...
..

It then modifies the php.ini, stores the analysis file elsewhere, or simply does not save it.

# Close Xdebug Profiler on php.ini
xdebug.profiler_enable = Off

Then delete the Xdebug performance analysis directory and the PHP var tracking directory

Rm-rf/tmp/profilter
Rm-rf/tmp/trace

Check the hard drive again and find that it has been used for 26%, remaining 4.9G.

FileSystem  Size  Used  avail use%  mounted on
/dev/sda1  6.8G  1.7G  4.9M  26%  /
...

Not even restart the httpd server, refresh the Web, and run normally!!!

To avoid complications, we need to install a regular cleaning software--tmpwatch, set the/etc/cron.daily/tmpwatch configuration inside the time

Usr/sbin/tmpwatch "$flags" 30d/var/tmp

Change to 7d (must be in days)

Usr/sbin/tmpwatch "$flags" 7d/var/tmp

One week regular cleaning.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.