Debugging console for Solar

on Mon, 1 Dec 2008 at 18:29 in php solar projects with 2 comments

Here's a little project I've been working on. It's a debugging/profiling console for Solar applications. I call it Starburst_Debug_Console. It displays a console on top of your website which shows you your SQL queries, logs and $_SERVER vars.

SQL Profiler for Solar

You can download it by clicking here. There's install instructions over at the project page. Yep, that's git, go ahead and fork it!

On PHP Namespace Separator

on Wed, 5 Nov 2008 at 23:41 in php with No comments

There's been a lot of negative commenting around the choice of the new namespace separator for PHP. The choice was backslash '\'. The usual answer to these comments is: "Pick a better one, and let's see how that works out" or "please stop commenting, '\' is the only one that works".

And I understand this. '\' is the only viable choice.

But the thing is, backslash sucks as a namespace separator. You can't create namespace names with string interpolation because '\n' would then get transformed to a newline. But above all, it's ugly.

I'd much rather live without namespaces than have a bad (ugly) implementation. I mean, do you really want namespaces this badly?

Also, the old excuse of "you don't have to use namespaces" completely misses the point that I have to maintain some poor guy's code someday that has namespaces in it.

Solar 1.0.0alpha2 Released And A New Blog

on Sun, 21 Sep 2008 at 15:34 in php solar with No comments

A new version of Solar has been released. You can see the full list of changes on our new blog. Yep, that's right, the Solar project now has a blog. Keep your eye on it for some cool Solar knowlegde. I will be blogging there about Solar and maybe cross-posting some of the stuff here too.

HTTP streams are usable in 5.3.0

on Wed, 23 Jul 2008 at 23:35 in php solar with No comments

While working with my Solarified wrapper for Amazon's S3, I found out that prior to version 5.3.0, HTTP streams in PHP are almost unusable.

Read more...

About Solar's documentation

on Fri, 2 May 2008 at 18:43 in php solar with 5 comments

I've heard people complain about the lack of documentation for Solar. While I generally agree, there's something I have to say to defend Solar. There's also a few things about framework documentation in general that I feel the need to talk about.

Read more...

Persistent Logins with Lux and Solar

on Thu, 13 Mar 2008 at 17:58 in php solar lux with 1 comment

In my previous entry about SQL authentication with Solar I promised to tell about implementing Persistent Logins (a.k.a "Remember Me" -feature) with Solar. I will use the previous entry as a starting point and add functionality to it, so be sure to read it first. I will first describe the idea and then show how you can implement it on your site.

The code is part of the Lux project that I maintain together with Rodrigo Moraes.

Read more...

PHPDeveloper.org made it's move to Solar

on Wed, 12 Mar 2008 at 22:04 in php solar with No comments

Chris Cornutt (a.k.a enygma) launched a new version of PHPDeveloper.org. The site is now powered by Solar!

It is always good to hear about new sites running on Solar. What makes this special is that Zend Framework got replaced by Solar :-).

Just a quick note to let everyone know that I've set up git mirrors for Solar, Sungrazr and Lux. I'm pulling new changes every hour or so. For example, to clone Solar you would do:

git clone http://git.anttih.com/project/solar.git

These are all unofficial mirrors. All of these projects use Subversion as their official version control system. I just have to use git locally for managing all my patches. More about my git experiences in another post.

Sungrazr is Peripheral libraries for the Solar Framework and it is maintained by Clay Loveless from Mashery fame.

Lux is also a set of libraries for Solar maintained by myself and Rodrigo Moraes.

I think it's a pretty common habit to have your usernames and passwords stored in a database table. This little tutorial shows you how to implement SQL-based authentication with Solar. Because of Solar's tight configuration mechanism, this is a walk in the park.

Read more...

APC user cache and FCGI

on Wed, 13 Feb 2008 at 17:26 in php solar with 1 comment

I had a weird experience a while back when implementing a cache for one of my sites. I figured I'd use APC's user cache because it's pretty fast. All was fine and the site seemed to work really fast. So next thing I did was try ab on it to see how fast it really was. Man did the performance drop. The whole server collapsed! I couldn't make a single request to the server.

The cache was for DB query data (surprise :-), so I took a look at show full processlist. It showed it was running queries multiple times that should not have been running at all. This seemed weird, to say the least.

Next, I took a look at APC's status with apc.php and saw my cache keys there like they should be. So again, I tried ab and refreshed the stats page. Now it displayed a completely different page than previously; some of the keys were missing. I tried refreshing, and again, the results changed.

Then it hit me. It must have something to do with the nature of FCGI because my ab tests would make Apache to spawn new FCGI processes to be able to handle concurrent requests (ab -c). It's pretty obvious: APC has it's own cache for every FCGI process. Not only for user cache but for opcodes as well. With opcodes this is not so bad but a user cache will take a lot of your memory if the same data is stored multiple times. It can also be really slow to setup cache entries for every process.

I didn't want to have data cached multiple times in memory so I switched to memcached. Memcached sends data over a TCP connection so it's a bit slower than APC user cache, but who cares.

Because I'm such a Solar fan-boy I'll tell you that Solar has cache adapters built-in for both APC and memcached. See the full list of cache adapters for Solar here.