Posted in Linux, PHP

After upgrading to 11.10 recently, I occasionally noticed fuser firing up and using between 70% and astoundingly 9999% CPU. Googling the issue led me to this post with the solution.

As user grazer explains:

We have the same problem. This is the content of /etc/cron.d/php5 on 11.10:

09,39 *     * * *     root   [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -depth -mindepth 1 -maxdepth 1 -type f -cmin +$(/usr/lib/php5/maxlifetime) ! -execdir fuser -s {} 2>/dev/null \; -delete

And this is the content on 11.04:

09,39 *     * * *     root   [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -depth -mindepth 1 -maxdepth 1 -type f -cmin +$(/usr/lib/php5/maxlifetime) -delete

Spot the difference?

The 11.10 version runs fuser for each PHP session file, thus using all the CPU when there are hundreds of sessions.

After commenting out the 11.10 line and replacing with the 11.04 equivalent, this problem was solved for me aswell. Thanks, grazer!

You can also check out the bug report to keep up to date on this issue. Hopefully a fix will be released quickly.

Read More »

Posted (Updated ) in Linux

Note: Also see the prequel to this post: Why I Hate Unity

As your typical Ubuntu user, I find Unity infuriating and have devoted countless hours towards bringing back the usability and functionality that came with Gnome 2. I’ve racked up quite a few tweaks so far that have gone a long way towards doing this and figured it was about time to share them. My aim was to make 11.10 look and feel exactly like 10.10. I’ve attached below a screenshot of the final result.

11.10 with Gnome Session Fallback
11.10 with Gnome Session Fallback

Read More »

Posted 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 »

Posted (Updated ) 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 »

Posted (Updated ) 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 »

Posted (Updated ) 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 »

Posted (Updated ) 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 »

Posted (Updated ) 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 »

Posted (Updated ) 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 »

Posted (Updated ) 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 »

Page 3 of 512345