suphp_log -- Need solution for quick fix

buckshot101

Member
May 12, 2007
17
0
151
SInce March, suphp_log has reached its limit 3 times already.

Without having to contact my dedicated server managed support and waiting hours for the the problem to be fixed, how can I fix the suphp_log file myself via root (putty) or winscp to limit the php downtime and unhappy customers.

Need command info on how to either rename or delete it.

Thank You.
 

maever

Active Member
Sep 26, 2005
31
0
156
Would you care to further elaborate your question ?

What happens when the suphp log becomes "full" does the apache server go offline?
 

sohmi

Member
Sep 11, 2008
8
0
51
Hello,

When the suphp_log becomes full (2G) you get an :

Internal server error

in the sites that need write in it. This has happened to me today :P

To avoid this you have to configure the suphp_log file in de logrotate.
 

JPC-Rizwan

Registered
Feb 23, 2009
2
0
51
You can enable rotation for suphp and other apache logs from below link in WHM gui :

WHM >> Service Configuration >> Apache Configuration

-- Apache Log Rotation Configuration
 

sparek-3

Well-Known Member
Aug 10, 2002
2,022
227
368
cPanel Access Level
Root Administrator
Where is the suphp.log file located?

You can just use a command line of:

Code:
>/var/log/suphp.log
to empty out the file. This keeps the log file at the same inode, and doesn't require an Apache restart. Just replace /var/log/suphp.log with the correct, full path of the suphp.log file.
 

Misiek

Well-Known Member
Feb 23, 2004
116
0
166
cPanel Access Level
Root Administrator
Hello,
The best way ist to change in suphp.conf log_level from info to warn, you will loose nothing ant the log will be small, very small
 

hm2k

Well-Known Member
Jul 19, 2005
93
0
156
I too have experienced this issue.

Removing the log file and enabling apache log rotation seems to have solved the issue for now.

Is there any reason why this isn't enabled by default?
 

Spiral

BANNED
Jun 24, 2005
2,018
8
193
Without having to contact my dedicated server managed support and waiting hours for the the problem to be fixed, how can I fix the suphp_log file myself via root (putty) or winscp to limit the php downtime and unhappy customers.
I don't know who you got managing your server that it takes "hours" but where I am at, and we provide server management services, it would be extremely rare and unusual for things to take that long unless you were talking some major catastrophic emergency requiring a complete server rebuild or something along those lines. For simple things like what you just mentioned, we'd probably notice before you do! ;)

Need command info on how to either rename or delete it.
Thank You.
Your SuPHP log is actually located in the "/usr/local/apache/log" folder
and you could rename, archive, or delete it and that will take care of
things being too large with the log file.

You could use Cpanel log rotation as previously mentioned and this will help but doesn't roll until the maximum line typically and at this point, your server performance is already impacted before the sites actually die. However, there are better solutions ...

Drop the following in your /etc/cron.daily folder and it'll roll your suphp log file daily and keep a full week's worth of archives:
Code:
#!/bin/bash
IFS="$"
typeset -i NLOG=0

cd /usr/local/apache/logs

## Remove last log in sequence
if [ -f ./suphp_log.7.bz2 ]; then
  rm -f ./suphp_log.7.bz2
fi

## Remove temporary working file
if [ -f ./suphp_log.1 ]; then
  rm -f ./suphp_log.1
fi

## Age remaining logs
for OLOG in 6 5 4 3 2 1; do
   NLOG=${OLOG}+1
   if [ -f ./suphp_log.${OLOG}.bz2 ]; then
      mv -f ./suphp_log.${OLOG}.bz2 ./suphp_log.${NLOG}.bz2
   fi
done

## Roll current log file
cp ./suphp_log ./suphp_log.1
cat /dev/null > ./suphp_log

## Compress rolled log file
/usr/bin/bzip2 ./suphp_log.1

## END OF SCRIPT
Download to "suphp_log_rotate.cron" or whatever file name you like! ;)

Set permissions to "700" and drop in /etc/cron.daily folder


EDIT: If you initial suphp_log file is unusually large, you may want to clear it before running the initial log rotate
 
Last edited: