Archive for the ‘Linux’ Category.

.htaccess for Dreamhost users

If any of you it’s currently using Dreamhost as Hosting provider, since yesterday they had made some modificataions deprecating “Options +FollowSymlinks”.

This means your site will return an 500 Error.

After talking to the support for more than 1 hour they admitted they have made changes in the policies and now we should use “Options +SymLinksIfOwnerMatch” instead.

Pretty bad communication from them and making this changes without noticing them.

If you are affected by this issue, please your .htaccess for Open Classifieds should look like this to get to work:

ErrorDocument 404 /
Options +SymLinksIfOwnerMatch
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule ^category/(.+) index.php?category=$1
RewriteRule ^offer/(.+) index.php?category=$1&type=0
RewriteRule ^need/(.+) index.php?category=$1&type=1
RewriteRule ^type/(.+) index.php?type=$1
RewriteRule ^publish-a-new-ad-for-free/ new/index.php
RewriteRule ^contact/ contact/index.php
RewriteRule ^privacy-policy/ privacy/index.php
RewriteRule ^sitemap/ sitemap/index.php
RewriteRule ^advanced-search/ search/index.php
RewriteRule ^map/ map/index.php
RewriteRule ^(.+)/(.+)/(.+)/(.+)$ item.php?item=$1&type=$2&category=$3&title=$4
</IfModule>

Remember that needs to be in your language.

This would be fixed for Open Classifieds 1.6.1 that is coming soon with few improvements to make your life easier.

I’m getting pretty annoyed by this hosting, since I use a Privvate Server and this things should never happen (as this other one http://j.mp/d8WVXY).

More or support for Open Classifieds in the forum.

Ubuntu 9.10 Karmic Koala in Eee PC 1101HA

Since I bought my beloved Eee PC 1101HA (wonderful screen and battery life), I’ve been using Ubuntu 9.04, yesterday I’ve decided to upgrade to Karmic Koala.
Eee PC 1101HA

When I’ve installed 9.04, I had problem with the network (wifi and ethernet drivers), and the display drivers. That was all, the rest was great.

When I did the upgrade, the display once more was not working properly but the worst was the speed connection, awful.

Then I’ve decided to do a fresh clean installation: Continue reading ‘Ubuntu 9.10 Karmic Koala in Eee PC 1101HA’ »

Spotify links in Chrome on Gnome/Ubuntu

I like spotify a lot, but was bothering to me a lot that I couldn’t open the links in Chrome…

After trying few solutions (for KDE, gnome ), I finally managed to make it work:

First you need to install Spotify in linux

At the console we create this script:

echo '#!/bin/sh' > ~/.browser2spotify
echo 'wine  "$HOME/.wine/drive_c/Program Files/Spotify/spotify.exe" /uri "$@"' >> ~/.browser2spotify
chmod 755 ~/.browser2spotify

Then we change few options from gnome to know what to do with the url’s:

gconftool-2 -t string -s /desktop/gnome/url-handlers/spotify/command "/home/${USER}/.browser2spotify %s"
gconftool-2 -s /desktop/gnome/url-handlers/spotify/needs_terminal false -t bool
gconftool-2 -s /desktop/gnome/url-handlers/spotify/enabled true -t bool

Remember to replace the user name in the folder.

That’s all!

To see if it works, try to open this any from this list:

Top 100 2009 PlayList
Continue reading ‘Spotify links in Chrome on Gnome/Ubuntu’ »

Free SMS Notification for high server load

I’ve found in foros.ovh this interesting script that notifies high server load to you using an SMS.

All of this works thanks Google Calendar and his API.

Steps:

  • First of all you need a google account and then sign in google calendar.
  • Then go to your google calendar -> settings (right top bar) -> mobile setup
  • Follow the instructions to add you phone number.
  • After this Settings->Calendar Settings and in any of them click on Notifications.
  • Create an Event reminders, SMS 0 Minutes.

With this, now every time we create a new event in google calendar just on the time (because of that 0 minutes) we will receive an SMS to our phone.

Try it, come on!

The Script:

To make this script work you need to have Zend Gdata (http://framework.zend.com/download/gdata/) downloaded or you can download the script + Zend Gdata here.

// Config
define('EMAIL','xxxx@gmail.com');//gmail account used in google calendar
define('PASS','xxx');//your gmail password
define('SERVER_NAME','your_servername');//just as reference server name
//level of avg load http://php.net/manual/en/function.sys-getloadavg.php
define('LEVEL_EMAIL',3);//load average to notify by email
define('LEVEL_SMS',5);//load average to notify by sms
// End Config
 
//Loading Zend_Gdata libraries
ini_set('include_path', 'ZendGdata/library');
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Calendar');
//End Loading Zend_Gdata libraries
 
// Function to create a new Google Calendar event
function createQuickAddEvent ($client, $quickAddText) {
  $gdataCal = new Zend_Gdata_Calendar($client);
  $event = $gdataCal->newEventEntry();
  $event->content = $gdataCal->newContent($quickAddText);
  $event->quickAdd = $gdataCal->newQuickAdd('true');
  $newEvent = $gdataCal->insertEvent($event);
}
// End Function to create a new Google Calendar event
 
 
//load average
if (function_exists(sys_getloadavg)){
	$load=sys_getloadavg();
	$load=$load[0];
}
else{
	$content = file_get_contents("/proc/loadavg");
	$loadavg = explode(" ", $content);
	$load = $loadavg[0] + 0;
}
//end load average
 
 
//NOTIFICATIONS
 
// Email - Send email notification
if($load >= LEVEL_EMAIL){
    mail(EMAIL, "Alarm high server load (".$load.") ".SERVER_NAME, "");
}
 
//SMS - Add Event in Google Calendar
if($load >= LEVEL_SMS){
    $text = "Alarm high server load (".$load.") ".SERVER_NAME;
    $service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME; // service name Google Calendar
    $client = Zend_Gdata_ClientLogin::getHttpClient(EMAIL,PASS,$service);
 
    // Hour and minute with 2 minutes delayment
    $hour= date("H");
    $minute= date("i")+2;
 
    // Creates the event in Google Calendar
    createQuickAddEvent($client, $text." ".$hour.":".$minute);
}    
//END NOTIFICATIONS

Now just put the script in you cron for example every 15 minutes,

*/15 * * * * /root/scripts/SMS_High_Server_Load/sms-load.php >/dev/null 2>&1

Other ideas, using this system is to send SMS when your site is down with this script.

Improve LAMP performance, for low cost servers or VPS

lamp_logo

As I said last day I’m just in a migration, I just did 2 sites a really not relevant one and deambulando.com, with lot of visitors. The server I’m using should be enough to handle the amount of visitors, but just in case I do a bit of tuning to improve the overall performance of the machine.

This config is meant for VPS servers like (or kind of):

  • Celeron 1.2Ghz
  • 512Mb Ram
  • 10Gb HD
  • 100Mbps upload/download
  • Linux

Depends in witch linux version you are running the LAMP the files can be in different paths, to find them you can always use : locate my.cnf
Continue reading ‘Improve LAMP performance, for low cost servers or VPS’ »

Follow me