Our First Big Fight

I’ve been using CodeIgniter for the past 6 months or so and while we’ve had our minor indifferences, I’ve thought of CodeIgniter to be a pretty decent PHP MVC. There was very little learning curve for me and we hit off quite easily. We were like peas and carrots. Unfortunately, as go most relationships, I knew this “new love” wouldn’t last forever.

How it Started

I had been working on a project for about a month or so when I decided to make a very minor tweak to a database column. I’m not sure if this is what kicked it off or what, but I tested my changes and I get the good ol’ WSOD (White Screen of Death). In PHP, this is very bad, mmk. What this means is an error has occurred somewhere in your code, and PHP’s not telling you where. I was stunned. I had no idea where to start other than reverting my tiny change which I knew wouldn’t make a difference at all. I did, and of course, still nothing.

How I Dealt With It

I first pinpointed where the problem was occurring, and it was during the call to parent::Controller() in the constructor of my default controller. So, I hit up the CodeIgniter IRC channel to see if anyone had had this problem before. Nobody seemed to have any advice except for to enable CI’s logging feature, set it to level 5, and stand back. Since I had no idea what was supposed to be occurring in the background, I pastebin’d the log, where a user responded, “It seems to be stopping at the Encryption Library. PHP isn’t loading the mcrypt.” Ah, ok. I’ll go enable that.

My Computer > PHP > php.ini > Uncomment mcrypt extension > Restart Apache

Apache doesn’t start back up. It can’t find the mcrypt library. Well, I don’t appear to have it in my ext folder. Why? I don’t know??? Off to PHP’s site to download it. Well, I thought maybe this is a good time to go ahead and upgrade PHP. Big mistake…..

The Frustration

I am by no means a server administrator. I know enough to be dangerous, that’s about it. When it comes to troubleshooting server problems, I miserably fail. I had setup PHP/Apache/MySQL through a tutorial I found a while back, although I can’t recall which one, but setup was not too bad. Now diving back into that, I knew I had really screwed up. After downloading many different versions of PHP for Windows, I realized I needed to actually RTFM and get the right one. Still I was unsuccessful in starting Apache. Ok, maybe my version of Apache won’t work with the latest version of PHP. Let’s upgrade that.

I finally get Apache starting, however PHP would seem to “lock up” whenever a database connection was being made, causing Apache to crash with no errors in it’s error log.

I think I completely uninstalled and reinstalled PHP/Apache 6 times in about 6 different ways. Completely frustrated and at a loss, I resorted to installing XAMPP. I wanted to be one of the cool kids and have my own Apache server running on my machine, but I guess I’ll have to wait for that day to come.

The Resolution

So now that I had my webserver back up and running, I was pretty much back to square one with the WSOD. After a few days, I had also noticed that the page would load after it had “sat” for a while, but upon refresh would fail. I began my normal Debugging routine by echoing various numbers and obscenities throughout the code until something doesn’t work, I started with the Session library, thinking this is where my problem lied. I dug deep and dug hard and hit something!

Can you spot it? What on earth is an @ symbol doing in there? Who would do such a thing? What cruel developer thought it would be a good idea to do that? *In case you didn’t know, @ suppresses any errors on what appears to be the entire line of code, or at least the ones inside the scope.

So I dropped the @, received my long awaited error message, and could finally move on developing whatever it was I was doing in the first place.

The Closure

I found my problem where I was using my own helper called ‘string’, which was causing CI’s helper not to load. I renamed it, and everything’s back to normal.

I’ve never contributed to an open source applications, although I’ve always felt I wanted to, but was nervous that I might screw something up, or do something wrong. I feel like CI would be a great project for me to contribute to. I already have a few things I’d like to add, but I’m not really sure how to go about doing it. Is there some sort of etiquette to getting involved? Is there a set of rules I should know? Should I be nervous about breaking something when it seems like there are already developers working on it that leave @ symbols instead of writing the necessary code to handle any issues? I would love to get some feedback on this sort of thing.

Write a Comment