Well, today I’ve reached another milestone. I should start outlining how I want to proceed, but I’ve been so focused on coding that I haven’t had much energy to do much else. Between yesterday and today, I managed to get the site and database ported over my web hosting provider on a staging/development domain name. That makes it sound like it was an easy feat, but it wasn’t.
First, I had to plan out my update process. The goal of the staging site is to allow others to start utilizing the software, without opening it up to everyone. It will also serve as an external testing environment once the site goes live. Some would call my current application state an alpha, some call it a private beta, but whatever term is used, it is a volatile, error-prone version that is not really ready, but I need to start gathering feedback and outsider opinions.
So, I created the staging environment, created a staging database, then FTP-ed all the files and synchronized the database model. I go to the domain and can you guess what happened? Errors up yin-yang. I kind of expected this to happen, though, since it was certain that my hosting provider’s configuration of Apache is not the same as my local MAMP setup (Mac + Apache + MySQL + PHP). I was eventually able to get it running, and added a simple session-based password protection thingy so no one can really access it unless they know the secret code. I also added a robots.txt that disallows robots from crawling the site, so Google, Bing and the others don’t start caching those URLs.
Once it was running, I started going through and retesting all of the functionality and some things worked and some things didn’t. One of the most annoying hurdles was a particular PHP function, called finfo_open(), which I was using to determine the MIME type of a user-uploaded file. You see, finfo_open() is the “new” way of doing things, since the older PHP function, mime_content_type(), was deprecated after PHP 5.2. Since my hosting provider runs a more recent version of PHP, 5.4 at the time of writing, finfo_open() is the correct way to do this. However, my hosting provider disabled the functionality (a PECL extension called fileinfo that needs to be added via a php.ini or in the Apache config) for security reasons.
Since it’s a shared hosting environment, meaning other websites are using the same server, I can understand, I guess. But, by doing this, they are inadvertently forcing me to be LESS secure, since I had to write a workaround when finfo_open() is not present that checks the uploaded file extension against an associative array that maps extensions to MIME types. That’s sucky, but it will be alleviated once I switch to a dedicated server and can ensure the fileinfo extension is working.
Other than that, the hosting provider was set up to output PHP Notices, whereas my local setup was configured to only render Fatal errors and Warnings. This is actually a good thing, in my opinion, because it forced me to fix a few issues that I overlooked since the notices weren’t being thrown locally. I’ll either address this in PHP to override the server configuration at runtime, or just update my local instance so I can be sure to write more foolproof code.
Now I’ve got it running as smoothly as it was locally, so I can officially start this feedback gathering stage and continue working towards a public beta, which hopefully won’t be much longer. But, I really should start documenting the my processes for keeping track of local and staging versions, updating staging (and production, eventually), as well as planning out the future phases of development, both on this web application component and the other components that I have been brainstorming.