Recently in LAMP Category

I have historically had several servers at Layered Tech. They recently raised their prices, and the prices for several friends who have hosted servers there. The majority of our use is low volume, experimental sorts of things, and so we decided to go in together on a larger box that we could virtualize.

Enter Voxel, who offer a $199/mo dedicated server that includes:

  • 4 GB RAM
  • Quad XEON 2Ghz
  • 320GB SATA disk (which are growing more standard among these providers, but a lot of options are still IDE
  • SSH-accessible serial console access included

That last one is a serious nod to their foresight and a judo chop to other providers. Layered Tech overs a KVM solution as a $30 or $35/day rental. Voxel automatically includes it.

Anyhow, with this beefy box, we set about setting up Xen. Voxel's support was admirable when my initial xen install broke the serial console access. It turned out my /etc/grub.conf needed a change:

title CentOS (2.6.18-53.1.21.el5xen) root (hd0,0) kernel /xen.gz-2.6.18-53.1.21.el5 com1=9600,8n1 module /vmlinuz-2.6.18-53.1.21.el5xen ro root=LABEL=/ console=tty0 console=ttyS0,9600 panic=100 module /initrd-2.6.18-53.1.21.el5xen.img

(Change in bold)

Without the com1= line, it defaulted to 38400.

Anyhow, with that done, I got to work actually setting up Xen virtual server instances. The host box (aka the Dom0) is CentOS, and so the "easy" install should be another instance of virtualized CentOS, although any variant should be usable. I tried to use virt-install, but it failed miserably.

First, I had issues with networking. Even when I resolved those, halfway through anaconda installing packages, the system crashed.

Ultimately, I settled on doing it manually using this guide to installing CentOS DomUs on a CentOS Dom0.

Caveats for me included the fact that my bridge was virbr0 instead of xenbr0. I have a xenbr0, it just wasn't the correct bridge for RFC1918 going out...

Anyhow, aside from the networking problems, that went fairly smoothly. (Although the top of the guide has you selecting from i386 or x86_64, and the kickstart config just says i386, so I had to restart to correct that, since I was doing the x86_64 install.

Still on the agenda: getting a real IP address. Voxel offered a reasonable extra 8 IPs for $4/mo, and we'd like to ensure each VPS has its own IP address, not 192.168 addresses that translate.

Still, this has been a pretty fun thing so far. I've heard that Xen is what Amazon is using to provide AWS, and I've been learning a lot of new linux tools (like brctl; I'd never had a reason to do linux bridging prior to now, even though I've done it plenty with networking devices).

When you send a request via $.ajax, $.get, or $.post in jquery, you can test for the HTTP_X_REQUESTED_WITH header, looking for a value of 'XMLHttpRequest', a la:

function isajax() { return ((!empty($_SERVER['HTTP_X_REQUESTED_WITH'])) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'); }

But what happens when you're using the jQuery Form plugin? Normally, things work fine. Below the cut for a serious caveat!

Today I had the opportunity to play with event bubbling and applying generic event handlers. Quick overview on handling them (with jquery!) and which events cannot be cancelled.

Put this in your toolbox

| | Comments (0) | TrackBacks (0)

I'm going to admit to not having used this yet. But having used a lot other solutions (most recently pear Safe_HTML with additional pre/post-processing), this is a breath of fresh air: HTML Purifier

If you use MySQL, note this:


mysql> create database test;
Query OK, 1 row affected (0.01 sec)

mysql> use test;
Database changed
mysql> create table foo (
-> x int,
-> y int
-> );
Query OK, 0 rows affected (0.00 sec)

mysql> insert into foo values (1, 2);
Query OK, 1 row affected (0.00 sec)

mysql> select * from foo;
+------+------+
| x | y |
+------+------+
| 1 | 2 |
+------+------+
1 row in set (0.00 sec)

mysql> update foo set x=5,y=10,x=x+y;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> select * from foo;
+------+------+
| x | y |
+------+------+
| 15 | 10 |
+------+------+
1 row in set (0.00 sec)

mysql>

I bolded the part that bothers me. No warnings. Double-updating the same value in the same row in the same statement throws no warnings (never mind errors!). I haven't checked the ANSI standard to see if this is mentioned, but it sure is worth noting.

I wrestled a while today with client authentication with CA Certs. Setting up a CA and signing certs with a CA is a little trickier than doing cert self-signing. Here's some details.

September 2010

Sun Mon Tue Wed Thu Fri Sat
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Creative Commons License
This weblog is licensed under a Creative Commons License.