Category Archives: Linux

Internal Error Server 500

On a cPanel server running suPHP getting Internal Server Errors can be caused by file or directory permissions. One of the best ways to diagnose such issues it to look at the suPHP log files and fix any errors that are reported.

tail -f /usr/local/apache/logs/suphp_log

Fixing cPanel file permissions

Just for my own note
After installing suPHP on server, execute :

find /home/*/public_html -type d -exec chmod 755 {} ;

This command fix all folder permission

find /home/*/public_html -name '*.php' -o -name '*.php[345]' -o -name '*.phtml'| xargs chmod -v 644

This command fix all file permission

#!/bin/bash
cd /var/cpanel/users
for user in *
do
chown -R $user.$user /home/$user/public_html/*
done

This script fix all ownership issue

cPanel missing dedicated IP

Every now and then I get a site on our cPanel servers that stops working. After investigating the issue it turns out to be a missing IP from the cPanel server. Here is the latest remedy I found for this:

/scripts/rebuildhttpdconf
service httpd restart
service cpanel restart

Clean HTTP Usage in cPanel IP Usage table

Once again this is a place holder for myself as to the steps needed to change a phantom entry in the IP Usage Table in cPanel. We run our cPanel servers on VM within our environment. So we have a cPanel template that is used to spin off new servers as needed. The IP and host name of the newly spun off servers has to be changed and sometimes the old entries get stuck in this table.

cd /var/cpanel/userdata/nobody
“ls” showed the following files:

main main.cache

nano main

/scripts/rebuildhttpdconf

/etc/init.d/httpd restart

Restoring a failed cPanel Apache build

If the Apache rebuilt is successful but httpd cannot be started due to configuration issues the following scripts can help to restore a previous or archived build.

# /scripts/easyapache --restore-archive
Bring up UI to choose available archives and restore them if desired

# /scripts/easyapache --restore-archive=listonly
List available archives only

# /scripts/easyapache --restore-archive=/path/to/easyapache/archive
Attempt to restore this build archive
!! only use if you are 100% sure the path is an easyapache build archive !!

Installing SNMP on CentOS

Once again I am documenting this here for my own purposes. I tend to find little caveats like this but loose them by the next time I need them. So I’m documenting how to install SNMP on a CentOS box. So far I’ve tried this on several physical and will be trying it on some vmware and xen virtual boxes next. After do you this you need to start the service ans set it to load at root.


yum install net-snmp
yum install net-snmp-utils

snmpconf -i -g basic_setup

service snmpd start
chkconfig --add snmpd

Converting MySQL to SQLite

I have begun playing around with SQLite and needed a way to convert a MySQL database into a SQLite database. After trying several different methods the one that I ended up going with was the script documented in this article.

Documenting it here so I can find it later myself.

Disabling iptables Console Messages

I’ve been searching for a solution to this and finally found one, so I’m posting it here just so I won’t have to search for it when I forget it again.

I initially thought the messages were coming from syslog-ng but it turned out that the messages kept coming even with syslog-ng turned off.

As it turns out, the kernel was printing those messages directly to the console. Fortunately, it’s possible to set the minimal level a message must have before it is printed to the console.

# dmesg -n 4

After executing this command, only messages having level “warning” (4) or higher will be printed. All message levels are still logged.