Updates to the website
Published: 09:45, Saturday 04 September 2010

My website is on the road again... Some weeks ago I tried to make some changes to it, but because of a series of problems I encountered I decided to rethink my workflow. Here's a technical review of my "migration".

Now I work on my website locally with Eclipse[1] and its plugin for php development[2]. For the first time I can program in php with auto completion and all features a good IDE offers. I don't know how I survived until now without code templates, without Ctrl-Shift-R or Ctrl-H and other really comfortable functions of Eclipse, which took the place of loyal Notepad++[3], a really good editor I'm still using for editing single files not making part of a project (or writing this post through the It's all text! Firefox plugin[4]).

For the update of the remote website I use FileZilla[5], which took the place of the Firefox addon FireFTP[6], which is almost perfect but with a fundamental missing feature: the capacity of limiting upload to only the most recent files.

To set up everything I encountered some problems:

  • The file with the database parameters was different locally and with the upload it would have overwritten the remote file - I solved it making an unique file with all parameters and changing the code to make it recognize in which version (local or remote) of the site it is.
  • Also the .htaccess file has a small difference (the RewriteBase) - in this case I couldn't find other solutions than remember not to upload that precise file (luckily it is in the main directory). This problem arises from the inability of the .htaccess to redirect to a file in the directory it is in (or in a directory relative to it) without knowing the absolute site url or at least the RewriteBase. An other solution could be to hide hidden files in FileZilla - I don't like it because I want to be able to see them (and because in future there might be hidden files which I want to be updated).
  • Why not Subversion[7] and its related Eclipse plugin Subversive[8] or Subclipse[9]? Because my website is hosted by GoDaddy[10], which seem not to support this software on their websites.

I made some other changes to my website which are fairly invisible to the user such as more flexible spreadheets and overall code extensibility enhancements (and fixing all the bugs caused by all those changes). Last but not least comes the possibility (for me, the admin) to upload files and link to them :).

Comments
10:26, Saturday 04 September 2010
-
By PvB

Hi Nicola

Nice overview of your working environment. Similarly set up to mine, although I mostly use subversion to deploy my code.

One idea concerning your database configuration file:
I use different directives/configurations for different states of deployment (production, staging, testing, development etc). The same config file can contain data concerning all stages:
[production]
directives (..)
[staging]
directives (..)

When reading the file with parse_ini_file (http://php.net/manual/en/function.parse-ini-file.php), I can access the all states and the corresponding directives.

To determine the correct state for the current environment I use an .htaccess file in a parent folder (which is not changed during the upload) with the "SetEnv VARNAME value" (SetEnv ENVIRONMENT development, for instance) directive. I access VARNAME as a constant inside php, thus accessing the correct directives.
(More on .htaccess: http://httpd.apache.org/docs/2.0/howto/htaccess.html)

Although it takes some thoughts to set up I would recommend this buildup as it is much more robust, especially if there are several different config files in different places for different parts of the page.

Enjoy your holiday!

Write a Comment
Name:
*
Email:
Website:
If you are human write 'd':
*
Title:
*
Your comment:
*
* These fields are mandatory.
© Copyright 2009-2011 Nicola Marcacci Rossi