Install IonCube Loader On A Cpanel/WHM Server

February 24th, 2010 admin Posted in System Admin No Comments »

If you’re running a webserver with Cpanel and need to use Zend’s IonCube Loader, you can easily install it by running this command via SSH:

/scripts/phpextensionmgr install IonCubeL oader

It will output something like this:

Updating md5sum list
Fetching http://httpupdate.cpanel.net/cpanelsync/easy/targz.yaml (0)….@75.127. 84.226……connected……receiving…100%……Done
Downloading tarball for IonCubeLoader
Fetching http://httpupdate.cpanel.net/cpanelsync/easy/targz/Cpanel/Easy/IonCubeL oader.pm.tar.gz.linux-generic-64 (0)….@75.127.84.226……connected……recei ving…2%…4%…6%…8%…10%…12%…15%…17%…19%…21%…23%…25%…28%.. .30%…32%…34%…36%…38%…41%…43%…45%…47%…49%…51%…54%…56%…5 8%…60%…62%…64%…67%…69%…71%…73%…75%…77%…80%…82%…84%…86% …88%…90%…93%…95%…97%…99%…100%……Done
Installing IonCubeLoader
Creating install directory at /usr/local/IonCube
Determining PHP version
Installing IonCube Loader binaries
Activating IonCube Loader extension in /usr/local/lib/php.ini
IonCube Loader extension activated

You can then check that it is indeed installed by entering this command via ssh:

php -v

Which will output something like this:

PHP 5.2.9 (cli) (built: Feb 23 2010 19:52:35)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
with the ionCube PHP Loader v3.3.10, Copyright (c) 2002-2009, by ionCube Ltd.

There are plenty of other methods to install IonCube Loader, but this simple Cpanel script seems to be the easiest. Many scripts, like our media hotlinking protection script, make use of IonCube Loader to run Zend protected PHP source code.

Click here to view full size

AddThis Social Bookmark Button

Use Memtest86 Before Deploying Servers

January 27th, 2010 admin Posted in Hardware, System Admin 1 Comment »

We’ve been building a few servers recently, and as part of our testing we performed a memory test on each of the machines. In doing so we discovered that one of the RAM modules was defective. We confirmed that the memory, not the cpu nor motherboard, was at fault by then testing the RAM in another machine.

System memory can be defective without being overly apparent, allowing you to install your operating system and use it normally for a period of time. After a while programs may begin to crash unexpectedly, and other system errors may occur.

By running Memtest86 before shipping the servers to the datacenter we have saved ourselves countless hours of remotely debugging the issue and coordinating a replacement of the hardware.

Memtest86 is free and can be downloaded as a bootable iso and in many other formats here. It is also bundled on Ubunutu installation disks, just boot from the cd/dvd and run the “memory test” option.

Below is a screenshot detailing over 400,000 memory errors. Working memory should not return any errors at all, one single error is cause for concern.

Check out the Memtest86 website for more details on how to determine which memory module is at fault, and whether your bios or voltage settings may be to blame.

Click here to view full size

AddThis Social Bookmark Button

Expanding A ReadyNAS iSCSI Volume

December 9th, 2009 admin Posted in System Admin No Comments »

iSCSI volumes are a great way to store data, at some point or another you may need to expand your iSCSI volume. If your volume is on a ReadyNAS you can easily expand the volume and then extend the drive/volume in Windows like so:

Log in to FrontView (at the ip of your server /admin, e.g. 192.168.0.100/admin), select volumes in the left hand menu, select the iSCSI tab.

Click the expand button for the volume you want to expand.

Click here to view full size

Enter the desired capacity and then click apply.

Click here to view full size
Click here to view full size
Click here to view full size

Once the expansion is complete you will need to then extend the volume in disk management in Windows Control Panel.

Open disk management.

Click here to view full size

Right click on the existing volume, and select Extend Volume.

Click here to view full size

The wizard will pop up, click next.

Click here to view full size

Choose the volume, and enter how much you want to extend it by. In this case it was 100GB and I am extending it by 100GB.

Click here to view full size

The volume will extend.

Click here to view full size

AddThis Social Bookmark Button

Emailing Script Contents With Bash

December 9th, 2009 admin Posted in System Admin No Comments »

When experimenting on our development servers in the office here we often find ourselves wanting to quickly backup the contents of whatever bash script we are testing before making further changes to the script.

You can use the cat and mail commands to email the contents of the script to yourself like so:

cat fileyouwant.sh | mail -s “Email subject is here,  script” youremail@domain.com

We used cat with pipe ( | ) to read the contents of the file and pass it to the mail command. We set the subject of the email using the -s parameter, and specified the email address at the end of the mail command.

AddThis Social Bookmark Button

Shell Script To Report Network Usage, bytes/sec

July 11th, 2009 admin Posted in System Admin, Web Development No Comments »

In distributed apps it is often important to know the current network throughput speed on a particular server to help balance file serving requests etc.

Installing MRTG or other software is not always desirable or possible. I created the shell script below to output the eth0 outbound transfer rate in bytes/second. To calculate megabits per second simply divide the output by 131072.

You could post the data to a remote URL (e.g. a master health server) or write it to an xml file for reading by remote server or app, etc.

The speed returned is the average throughput over a 55 second period, you can adjust this as needed. Tested on CentOS 5.

#!/bin/bash
txfirst=`ifconfig eth0 | grep “TX bytes:” | cut -d “:” -f3 | cut -d ” ” -f1`
datefirst=`date +%s`
loop=1
while [ loop=1 ]
do
txnew=`ifconfig eth0 | grep “TX bytes:” | cut -d “:” -f3 | cut -d ” ” -f1`
datenew=`date +%s`

if [ $txnew -gt $txfirst ]
then
transferred=$((txnew-txfirst))
timelapsed=$((datenew-datefirst))
if [ $x > 0 ]
then
bytessec=$(($transferred/$timelapsed))
echo “$bytessec bytes/sec”
fi
txfirst=$((txnew))
datefirst=$((datenew))
else
txfirst=$((txnew))
datefirst=$((datenew))

fi
sleep 55
x=$(($x+1))
done

AddThis Social Bookmark Button

Initialize an iSCSI Target in Windows Vista, Performance

July 7th, 2009 admin Posted in System Admin No Comments »

We recently upgraded our office NAS to the ReadyNAS Pro Business edition which supports iSCSI.

iSCSI offers block level access to your network storage, resulting in much improved performance versus traditional network storage protocols. The block level access means that iSCSI storage can be used with databases, etc.

Setting up the iSCSI target on the ReadyNAS was rather simple, and is explained here: http://www.readynas.com/?page_id=772

Setting up access to the iSCSI target that you just created in Vista is also fairly simple and is explained (with one omission) here: http://www.readynas.com/?page_id=809

In the article above it states that when you open disk management program the “initialize new disk” dialogue should appear. It did not appear for me, and it is poorly documented as to how to initialize a new disk which must be done before you can format the disk and assign it a drive letter.

To initialize the disk in Windows Vista, after setting up the iSCSI settings in “Control Panel” do the following:

1. Right click on your “Computer” and select “Manage.”
Click here to view full size

2. Select “Disk Management” on the left.
Click here to view full size

3. Scroll through the bottom area which displays your disks. Then right click the red plus sign on the Disk that needs to be initialized (Disk 5 in my case) and select “Initialize Disk.”
Click here to view full size

4. Unless you need otherwise, the default setting of MBR is most likely fine.
Click here to view full size

Now your disk has been initialized and can be formatted and mapped to a drive letter, which you can do like so:

1. Right click on the newly initialized disk and select “New Simple Volume.”
Click here to view full size

2. Navigate through the options, and assign a label and letter for your drive.
Click here to view full size

3. Your iSCSI volume is now formatted and mapped to a drive letter.
Click here to view full size

If when setting up the iSCSI target/discovery in your computer’s “Control Panel” you set the iSCSI target to be reconnected on each boot, the disk will always be available each time you reboot.

As for performance, small transfers (less than a couple of hundred megabytes) are copied extremely fast at about 120MB/sec (the full gigabit capacity of our network).

For larger file transfers the process starts out fast and then about half way through the process it slows down and eventually ends up at around 30MB/sec (approximately 240mbit).

These speeds are a lot faster than the 12MB/sec we get on our traditionally connected network volume on the same NAS.
Click here to view full size
Click here to view full size

AddThis Social Bookmark Button