SMEServer 7.4 Ion Cube PHP Loader

SME Server and its underlying CentOS setup do not include Ion Cube PHP Loader by default.

There is no ‘yum install ion cube’ option either due to the proprietary licence. However, there is a free download available from Ion Cube and its a quick install.

Installing ionCube Loader:

1. Download the program to your server using wget
[bash]#wget http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz
[/bash]
2. Unpack the program
[bash]#tar -zxvf ioncube_loaders_lin_x86.tar.gz[/bash]
3. This will probably be in your home directory or /root depending on your access to the SME Server. Move the ion cube directory to somewhere more appropriate:
[bash]# mv ioncube /opt/[/bash]
3. Go to the ion cube directory
[bash]# cd /opt/ioncube[/bash]
4.Copy these files to your SME Server Primary website *
[bash]# cp *.php /home/e-smith/files/ibays/Primary/html/[/bash]
5. Open this in your browser window
[bash]http://yourserver_url/ioncube-loader-helper.php[/bash]

and see something like this……

Ion Cube Installation
Ion Cube Installation

6. Now the issue is really not the install but the templating of the /etc/php.ini in SME Server. I’ll assume that you have NOT modified the standard php.ini previously. If you have then skip the obvious directory creation step.
[bash]# mkdir -p /etc/e-smith/templates-custom/etc/php.ini
# cd /etc/e-smith/templates-custom/etc/php.ini
# touch 70ZendIonCube
[/bash]

7. We now have a template component file ready for editing. I like mcedit – part of the midnight commander suite – but you can use pico or vi or your favourite editor to edit the content as:
[bash]zend_extension = /opt/ioncube/ioncube_loader_lin_4.3.so[/bash]
Save the file and exit your editor. The purpose of this is to preserve the customisation of the system when SME Server updates are installed.

8. Prepare the update to the php.ini from the templates
[bash]# /sbin/e-smith/expand-template /etc/php.ini[/bash]

9. Restart Apache
[bash]# apachectl graceful[/bash]

10. Refresh the browser window for the IonCube page and you should see

Ion Cube Installation Success
Ion Cube Installation Success

…. and that should give you an operating Ion Cube PHP loader on SME Server 7.4

MySQL Backups from Hosted server

My hosting provider WrenMaxwell provide servers with cpanel and if you ask for it ssh access. The MySQL access is restricted to just ‘my’ database(s) and in order to include these in my remote backup solution I wanted to automate the process.

SourceForge AutoMySQLBackup is a simple but very effective script. I uploaded it, set the common settings and ran it.

Adding it as a cron job will run it daily while adding some tweaks to my website backup script on my remote server now includes the resultant backups offsite as well.

Backups using Rsync website to home server

I have remotely hosted websites and my home network. Following some recent almost disasters I figured that it was time to create some automatedbackup processes.

So I started with one remote site and my SMEServer at home and used Troy’s guide mostly.

One change was that I have alternative port settings for SSH connections, so I had to modify this line:

$ rsync -avz -e ssh remoteuser@remotehost:/remote/dir /this/dir/

to

$ rsync -avz -e ‘ssh -p 3333’ remoteuser@remotehost:/remote/dir /this/dir/

the single quotes around the ssh command separates its parameters from the rsync parameters so you can add other ssh options if needed.

Making the keys etc worked fine, but a similar setting is required when transferring via scp.

scp /home/thisuser/cron/thishost-rsync-key.pub remoteuser@remotehost:/home/remoteuser/

changes to

scp -P 3333 /home/thisuser/cron/thishost-rsync-key.pub remoteuser@remotehost:/home/remoteuser/

note that ssh uses -p (lowercase) while scp uses -P (uppercase) to change/set the port #.

I also liked Troy’s verbose ‘whoami’ line

$ echo I am now $USER at $HOSTNAME

but I also used

$ pwd

to check what directory I was actually using before continuing.

Two things tripped me up when testing just prior to the cron job configuration.

So to debug I started by stripping the authorised keys back to just the certificate and it was fine. I then added in the command string to that file and tested again only to get a password prompt.

The issue was that I had the validate-rsync script on the local host and not the remote server so I copied that file to an appropriate location on the remote host and tried again and that worked.

The second issue was with the ‘from=’ host setting in which I tried the hostname rather than ip address and rsync did not like that at and again prompted for the password. Changing it to the ip address worked. Not sure why this is as all the documentation I have read indicates that the text option should work. I’ve left it as the ip address for now.

Having done that and proved that it all worked added a new template into /etc/e-smith/templates-custom/etc/crontab called 70remotebackups and added these lines:

$OUT = “”;
# note to self as to what this is doing
$OUT .=
“05 2 * * * root” . ” /home/e-smith/files/ibays/backups/files/scripts/myremotebackup.shn”;

This is setup so that I can add another site script into the same crontab component file.Then I ran the process to include my new custom template into the crontab file.

/sbin/e-smith/expand-template /etc/crontab

No need to restart anything as cron will pick up the changes automatically.

Throughout all the testing I have already got the first initial copy of my entire website and a few changes so thats all working nicely.

The next step at some point is to prepare further copies of the same stuff in order that I can recover intermediate changes when required. But that is another day.