Install PHP without Apache on Debian

When you go to install PHP on a Debian server, it will attempt to install a whole bunch of Apache packages instead. This is not very useful if you want to install a different web server, or no web server at all.

Directory listings slow with ftp server and CentOS

I recently installed the VSFtpd FTP Server onto a CentOS box and have a fairly tight firewall setup script using iptables. When I logged in to test it and issued an "ls -l" command it took a really long time for the driectory listing to come back. At first I thought it wasn’t going to show the directory listing at all but it finally did. This post looks at the solution to the problem.

SilverStripe and PHP version requirements

This post looks at the minimum PHP version requirements for SilverStripe. I will update this page as new versions are released and I upgrade the various SilverStripe websites I manage, noting any issues I experience. Please share also any experiences you have in the comments section at the end of the post. SilverStripe Server Requirements …

Read more

Web server setup, DNS and Email Hosting, Domain Registrars

I have two VPS servers, one in the USA and one in New Zealand. This post explains a little bit about my current VPS providers, web server setup, DNS and email hosting, and the domain registrars I use.

Current VPS providers

My New Zealand VPS provider is Sitehost, and my US based VPS provider is Linode. I moved to the Sitehost VPS from a dedicated server with the same company and to Linode from VPS.net.

The move at Sitehost from dedicated to VPS was to save money and move off physical hardware, and to Linode from VPS.net due to disatisfaction with service levels after being a customer for 15 months (towards the end, there was far too much downtime for my liking and I was fairly unimpressed with their support).

I’ve only been with Linode for a short time as at the writing of this post so we’ll see how that goes…

Roughly half my sites are on the USA based server and half in New Zealand; which goes where depends mostly on the target market.

Server setup

Both servers run Debian 5 and have the exact same packages set up, including PHP, MySQL, Apache, Exim and so on.

I have MySQL set up in a master-master replication relationship so no matter which server the records are modified on, they will be replicated across to the other. I’ll be covering how to set up MySQL with a master-master relationship next week.

The website files are synchronized between the two servers on a six hourly basis using rsync, initiated at the Sitehost end. It pushes its files across to the Linode machine and then pulls the Linode files back to itself.

Should anything go wrong with e.g. the Linode server, I can simply change the DNS records for all domains on that server to point to the Sitehost server and within about half an hour all those sites should then be served from the Sitehost machine.

DNS setup

I moved my DNS hosting to DNS Made Easy in 2004; prior to that I had been running DNS from my own servers but really didn’t want to have to deal with it myself anymore and wanted complete separation from the location of web hosting and DNS. I’ve always found their service to be excellent.

Email setup

I think it was in 2008 that I moved my email hosting to Google Apps. Prior to that I had been hosting email on my own server but it was a pain to manage and Google just deals with spam so much better. Again I also wanted separation between my hosting and email, and it means when I go to move hosting providers it’s one less thing to have to worry about.

Domain registrars

I use 1st Domains for .nz domains, GoDaddy for .com domains and Cheaper Domains for my single .au domain. I prefer to keep DNS hosting and domain registrars separate because it makes it easier to move domains between registrars should I ever need to.

Open a jQuery Facebox on page load

I was asked this morning how to go about opening a jQuery Facebox when the page loads; while I normally find dialogs that open in this way somewhat annoying they do have their uses when trying to show some form of disclaimer. This post shows how to do this.

Download Facebox

Download the Facebox plugin and associated files from http://defunkt.io/facebox/ There are a number of examples on that page but here I present a full HTML skeleton for you to start with.

Download jQuery from http://jquery.com/

Working example

View the working example here. This opens a new page and as soon as it’s loaded the jQuery Facebox dialog will be displayed without any user intervention.

The code

Here’s the full HTML and Javascript required to achieve this. Obviously you need to subsitute the Javascript and CSS url locations to where you have these located.

<!DOCTYPE html> 
 <html>
 <head>
 <title>Facebox on load</title>
 <link rel="stylesheet" href="/facebox/facebox.css" />
 <script src="/js/jquery-1.4.2.min.js"></script>
 <script src="/facebox/facebox.js"></script>
 <script>
 $(document).ready(function() { 
 .facebox.settings.opacity = 0.5; 
 $.facebox('This will display after the page has finished loading');
 });
 </script>
 
 </head>
 <body>
 
 </body>
 </html>

After the page loads, the dialog will display with the text “This will display after the page has finished loading”.

Getting the content via an Ajax request

To get the content from an Ajax request instead of it being hard coded into the HTML/JS, change this line:

$.facebox('This will display after the page has finished loading');
 

to this, changing the /path/to/remote.html to the URL of your content:

$.get('/path/to/remote.html', function(html) {
 $.facebox(html);
 });
 

Aligning HTML bullet points against the margin

Paddings and margins on <ul> and <ol> elements in HTML are fairly inconsistent across browsers, even when they are both explicitly set. This post looks at how to try to align these bullets points against a margin as consistently as possible across browsers.