Location of Error logs in a CPanel/WHM install

Posted October 29th, 2011 in Linux

I was receiving a 500 internal server error on one of my CPanel sites earlier tonight but the apache error logs in CPanel admin for that user showed nothing. Instead, I had to locate the global apache error logs. This information may help others so I’ve listed some of the most useful CPanel/WHM log file locations below:

Apache Logs

General Error and Auditing Logs:
Location : /usr/local/apache/logs/error_log
Description : All exceptions caught by httpd along with standard error output from CGI applications are logged here..
The first place you should look when httpd crashes or you incur errors when accessing website.

Domain Access Logs:
Location : /usr/local/apache/domlogs/domain.com
Description : General access log file for each domain configured with cPanel.

Apache Access Logs:
Location : /usr/local/apache/logs/access_log
Description : Complete web server access log records all requests processed by the server.

MySQL Logs

MySQL General Information and Errors:
Location : /var/lib/mysql/$(hostname).err
Description : This path could vary, but is generally located in /var/lib/mysql. Could also be located at /var/log/mysqld.log

 

For more log file locations, there are some great forum posts here and here.

Read More »

CPanel SoftException UID is smaller than min_uid

Posted October 29th, 2011 (Updated 31 Oct 2011) in Linux, PHP

I’ve was playing with EasyApache in a WHM install recently and after the upgrade I came across a strange error:

SoftException in Application.cpp:357: UID of script "/home/mysite/public_html/index.php" is smaller than min_uid
Premature end of script headers: index.php

Turns out this error is caused by apache being unable to read files added by root to a users public_html folder. A simple fix for this problem is to

chown -R mysite:mysite /home/mysite/public_html

Thanks to user ronniev of eukhost forums for his solution here.

Read More »

Switch Tabs with CTRL+Tab in GEdit 3

Posted October 15th, 2011 (Updated 26 Aug 2014) in Linux

One of my favourite plugins for GEdit2 was tabswitch. It made GEdit more consistant with browsers by allowing it to switch tabs with CTRL+Tab instead of CTRL+PgUp/Down. Ubuntu 11.10 comes with Gedit 3 and the plugin no longer worked – so I rewrote it!

This plugin will let you use CTRL+Tab to switch between tabs in GEdit 3. You can download a working implementation here.

Install it by copying the files into ~/.local/share/gedit/plugins directory (which doesn’t exist by default) or /usr/lib/gedit/plugins if you want it to work for all users. Remember to enable the plugin in Edit – Preferences – Plugins for it to work!

Read More »

Split Large MySQL Dump Files

Posted October 9th, 2011 (Updated 29 Oct 2011) in Database, Linux

I’ve been using my Cloud Database Backup script for a few months now for weekly scheduled backups of my MySQL databases to Google Docs. Everything has been going smoothly, however I’m starting to run low on quota. For this reason I decided to look into splitting the SQL dumps into chunks small enough to be convertible and doing an upload-convert rather than a zip upload which will result in literally unlimited, quote free database backups as frequently as I like! The focus of this post though is the actual splitting script which splits a given MySQL dump into chunks of x characters.

As always, download it here.

Read More »

Get Pidgin working with the Latest Skype

Posted October 5th, 2011 (Updated 29 Oct 2011) in Linux

Ubuntu fans who like having Skype chats appearing in their Pidgin windows will know of 2 useful packages – skype4pidgin and pidgin-skype. These used to work great, however with the latest Skype update things broke. You could send messages from your Pidgin window but wouldn’t see any responses from your contacts. Frustrating!

Anyway, it looks like the guy behind skype4pidgin has come up with a solution which he’s layed out on his website.

You’ll need to download skype4pidgin.deb, libskype.so and libskype_dbus.so (or obviously the 64-bit equivalents of you’re on Ubuntu64). Drop the .so files into /usr/lib/purple-2 remembering to back up the existing equivalents first and install skype4pidgin.deb.

That should be all there is to it. Pidgin is back to working the way it should. *whew*

Read More »

How to Automatically Import Missing GPG Keys in Ubuntu

Posted September 21st, 2011 (Updated 29 Oct 2011) in Linux

This is an issue that plagues me constantly. For each PPA you add to Ubuntu, you also need to import a GPG key for it. This is all fine and well – until don’t have the key and are unsure how to get it (often happens after a reformat). Try doing an update without a valid key and you’ll get the following:

BSOD - Ubuntu Updates style
BSOD – Ubuntu Updates style
W: GPG error: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY

Well we finally have a solution: launchpad-getkeys! This handy little tool will automatically determine which PPA’s require GPG keys and import them for you.

Finally. Sweet relief!
Finally. Sweet relief!

Install with:

sudo apt-add-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install launchpad-getkeys

Run with:

sudo launchpad-getkeys

Images taken from this howtogeek article. For more information see here and here.

Read More »

Quick Tip: Discover What’s Running On Port X

Posted September 4th, 2011 (Updated 29 Oct 2011) in Linux

This weekend I was trying to run a server on port 9000 but something was already on there. I had no idea what it was and needed to find and stop it. Here’s a super quick and easy way to do so:

You’ll need lsof:

sudo apt-get install lsof
lsof -iTCP:9000

The result I got was as follows:

COMMAND     PID      USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME
komodo-bi 31713 myuser   51u  IPv4 1234567      0t0  TCP *:9000 (LISTEN)

From there it was as simple as going into komodo and turning turning off its listener :)

Thanks to Laran Evans for his useful tutorial.

Read More »

Enable FTP Keepalives in Nautilus

Posted August 25th, 2011 (Updated 29 Oct 2011) in Linux

Update 2011-10-26: Added support for Ubuntu 11.04+ which uses slightly different FTP folder names

Lack of FTP keepalive functionality in Nautilus has been one of my biggest gripes in Ubuntu for a long time now. It’s infuriating attempting to open a folder only to discover the session has timed out and I need to reconnect. Well that problem is now solved!

Run the following bash script in the background each time you boot and you’re good to go:

#!/bin/bash
 
while true
do
	#10.10 and earlier
	ls ~/.gvfs/ftp* &> /dev/null
	#11.04+
	ls ~/.gvfs/FTP* &> /dev/null
	sleep 15
done

Many thanks go to the user who originally posted this script in a mailing list here.

PS. If anyone knows how to integrate this into a nautilus script I’d much appreciate it!

Read More »

How to Fix Strange Web Page Widths on Android Browser

Posted August 5th, 2011 (Updated 29 Oct 2011) in Linux, Uncategorized

I’m currently working on a mobile version of an existing website utilizing the Responsive Web Design paradigm. One problem I instantly came across was a perplexing page width issue on Android. Even with a blank, HTML5 webpage, the page width was appearing at almost twice the width of my phones native resolution (and 2.5x that of my browsers width). For the record, I’m using Android 2.3.3 vanilla with the default browser on a Nexus One.

Firstly an example:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js' />
<script type='text/javascript'>
	$(document).ready(function() {
		document.body.innerHTML = $(window).width();
	});
</script>
</head>
<body>
</body>
</html>

The above code gives a blank, HTML5 webpage that will display the pages width on load. When loaded, it would print ‘800’ on the screen – indicating the page was set to an 800px width. This was clearly wrong.

I quickly noticed that using the following doctype:

<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">

gave me the width I was expecting – 320px. Obviously this isn’t an acceptable solution for responsive web design and so another was needed. Meet viewports. With the addition of a simple META tag I was able to fix the issue (albeit losing the ability to zoom in the process). Simply add the following to your HEAD tag and you should be good to go:

<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=0;" />

With this line added, my page now prints 320 to the screen as it should.

For more information, please see this StackOverflow post on the issue.

Read More »

Upload and Download via SSH Terminal

Posted June 27th, 2011 (Updated 29 Oct 2011) in Linux

Tonight I needed to transfer files directly between two servers via the terminal and figured this would be useful information for others, so here’s how to do it:

Upload to a remove server:

$ ssh username@remote_address cat < localfile ">" remote_file

Download to your server:

$ ssh username@remote_address cat remote_file > local_file

Source: the incomplete news project

Read More »

Page 3 of 512345