30 lines
773 B
Bash
30 lines
773 B
Bash
#!/bin/bash
|
|
|
|
# ANSI color codes
|
|
RED='\033[0;31m'
|
|
YELLOW='\033[1;33m'
|
|
GREEN='\033[0;32m'
|
|
BLUE='\033[0;34m'
|
|
NC='\033[0m' # No Color
|
|
|
|
# Function to color the log output
|
|
color_log() {
|
|
while IFS= read -r line; do
|
|
if [[ $line == *"PHP Fatal error:"* ]] || [[ $line == *"ERROR:"* ]] || [[ $line == *"Error:"* ]]; then
|
|
echo -e "${RED}$line${NC}"
|
|
elif [[ $line == *"PHP Warning:"* ]]; then
|
|
echo -e "${YELLOW}$line${NC}"
|
|
elif [[ $line == *"PHP Notice:"* ]]; then
|
|
echo -e "${GREEN}$line${NC}"
|
|
else
|
|
echo -e "${BLUE}$line${NC}"
|
|
fi
|
|
done
|
|
}
|
|
|
|
# Start rsyslog service (if needed)
|
|
service rsyslog start
|
|
|
|
# Start Apache in foreground and pipe through color_log
|
|
apache2-foreground 2>&1 | color_log
|