Amazon S3

Very cool service. I updated beeets to pull all images from images.beeets.com, an S3 bucket. Also, all css files now go through

/css/css.php/file.css …which rewrites

url(/images/…) to

url(http://images.beeets.com/images/…)

And guess what, it all works. I had some bad experiences with the S3Fox firefox plugin in the past, but it’s since been updated and I’ve been using it regularly.

Also, using S3.php, all profile images now go directly onto images.beeets.com. Wicked.

So what does this mean? A few things:

1. Less bandwidth & work – beeets will spend more time serving HTML, CSS, and JS than images.

2. Safer – We were backing up profile images to S3 indirectly before, but the chances of S3 going down VS our hosting are slim.

3. Worse image caching – Before, I had .htaccess controlling all the caching for static files. I liked it that way. S3 doesn’t do this very well at all. Apparently it’s configurable, but I don’t know how…any ideas?

All in all, it should be better for beeets. Maybe we’ll actually let users have images bigger than 10×10 now ;)

Thumbs up to S3 (and probably all other Amazon web services).

Wow. You’d think it would be easy. In fact, it should have been. Compile a module, load it from apache. Recompile PHP with –enable-fastcgi…oh wait, I already had it in there (always thinking ahead!!). Change some apache settings.

Right? Yeah, right. It took two days. I can’t even really remember why. The biggest problem was that running make && make install in the mod_fastcgi source was NOT yielding a ‘mod_fastcgi.so’ as the documentation PROMISED! In fact, it installed mod_fastcgi.la instead, a highly useless file.

So how did the master get out of this bind? Beats me, try asking him. As for me, I had to run ‘ld -Bshareable *.o -o mod_fastcgi.so’ which is mentioned in some document from a long time ago in a galaxy far, far away.

Let me interject and say that the information on the FastCGI website is “not very well documented.”

Day 2. I figured, what’s the point of FastCGI if it’s not set up to connect to a remote App server? Maybe I don’t HAVE an external server set up, but we can pretend. Well that’s another nightmare. There’s a good external FastCGI guide written about it, and guess what it worked. Not really a nightmare at all, come to think of it. Quite pleasant.

All in all, shouldn’t have taken 2 days =P (I’m a tinkerer)…but fuck it, I have FastCGI now, ready to connect to all those App servers I have churning away in the background (one day).

In all the excitement, I also compiled and installed the apache worker-MPM. A few tests with ab didn’t really show any noticeable difference. But threads are cool, right?

Next up: figure out how to configure Apache to pass all requests ending in .php (whether the file exists on the web server or not) to our “app” server. Is this possible?

IIS and PHP

So tonight I helped a client set up PHP5 on IIS 7 using MSSQL 2005. These things always work great in theory but judging my my use of the word “theory” in italics, you can probably guess that things weren’t so smooth in practice.

The client was smart enough to get FastCGI working through IIS…something I would have probably rolled over on. From then on, it was an upward battle getting a simple PHP prototype project going.

In the later versions of PHP 5, it would seem that all mssql_* functions have…been… removed? There is an ntwdblib.dll that needs to be replaced to play nicely with mssql 2005…but it doesn’t exist in the latest releases. How strange. I ended up reverting to 5.2.5, making me a not-so-bleeding-edge pushover :’(. It’s cool though.

Then MSSQL doesn’t accept normal logins, only windows ones, and it’s bloomin’ impossible finding out how to change that.

One thing Microsoft seems to have actually done right is release a rewrite module (much like mod_rewrite) that you don’t have to frickin’ pay for, which is nice. On a side note, I really hated Windows Server 2008. It’s like Vista in every way, except that the design is slightly different, somewhat. Sorry, MS, but get your shit together plz, kkthxbai.

Anyway, we got everything going. What a pain in the ass though!

If you’re wondering, I’m more of a Unix guy ;). And yes, I have used a computer before.