Monday, November 11, 2013

Day 1: Setting up the environment

Join me in this thrilling tale of adventure on the high and stormy seas of programming!

Ok, ok... It's actually going to be (for most people) more boring than the most boring parts of "Moby Dick", and a lot less well-written. But enjoy the prose regardless, as a tale of redemption, inconsistent style, and the gross misuse of metaphores and late-19th century vocabulary.

Day 1: Setting up the environment

Before you can set out to sea, you've got to rig the sails. Something we talked about this morning during a workshop on optimised learning concerned the theory that it takes around 20 hours to learn something well.  That's 45 minutes of practice a day for about a month.  I brought up the point that often, with programming, a lot of time gets eaten up just setting up a working environment where you can succeed in practicing at all.  And like a self-fulfilling prophecy of doom, my attempt to set up the system requirements for an installation of Typo3 resulted in a detour of about 2,5 hours.  Here's the gripping narrative of the glory and the pain:

System Requirements for Typo3:
1) Graphics Magick or Image Magick
2) GDlib /Freetype
3) zlib
4) Apache with mod_gzip and mod_rewrite
5) PHP-Cache (APC, PHP Accelerator)

Requirements 1-3: I found out that these were already available on my system by checking out my PHP setup from the command line. I had to google to find out how to do this, but found results immediately that also happened to work: just type on the command line: php -i

Simple. I tried the same trick with Apache with less success. The first google results for checking the Apache version on the command line instructed: type on the command line: httpd -v

Fail. That bastard illegitimate son of a command line told me that it "couldn't find" the command. After some more searching I found that on Ubuntu you need to type the following command instead: apache2 -v.

Success! GD-support enabled!  Freetype support enabled! MySql - enabled!  ZLib enabled!  My heart soars!  "Just" two more requirements to go.  I must admit that I then succumbed to the deadly Sin of Pride, for which I duly paid the penalty: my attempt to "grep" the apache2.conf file from the command line had to be aborted after a many minutes of computation. On my word of honour, next time I shall first google the correct use of "grep". The following modest attempt to find a (legitimate) way to find out which modules are enabled in apache resulted in fruition: type on the command line: apache2 -l.

(I shall now switch to present tense to increase narrative excitement!)

Alas I have got a problem, for apparently neither the mod_gzip nor the mod_rewrite...mods are enabled.  My ever-reliable companion Google points me to Apache Toolbox, whose last update took place in the year 2006.  The instructions on the download site are delightfully simple, so I download it and unpack it in order to follow the instructions. It looks as if I am going to have to recompile Apache, which I *so very much* do not wish to do and furthermore, Apache Toolbox doesn't offer the mod_rewrite option. :( More google results on enabling mod_gzip only succeed in chilling me to the bone with a sense of premonitory doom. Toolbox is supposed to make this easy.

I will just have a look into the apache2.conf file. There I see that it handily loads all files found in the directory called "mods_enabled"... where I am crestfallen to find neither mod_rewrite nor mod_gzip. Another directory, "mods_available", wonder of wonders, reveals a "rewrite.load" file, which fills my heart with joy.  I can probably just copy that file into the "mods_available" directory and then surely I will have accomplished my task!  Ubuntu, however, insists on frusterating me in my endeavors.  I google how to enable mod_rewrite and I find some results that inform me: type on the command line: a2enmod rewrite.

Alas, abject failure. The gloom of thwarted ambitions is starting to cloud my troubled soul, and I finally decide to ask someone for help. My co-learner knows Apache and advises me to try the a2enmod rewrite command again, but this time as root:  sudo a2enmod rewrite

And that totally works, which is awesome. We both search for instructions on how to enable gzip without having to posess the qualifications of a Unix administrator.  I finally discover a precious gem of wisdom, that mod_gzip is for Apache 1.3 and that Apache 2.2 needs mod_deflate, which is as a brother, but faster.  Looking in my "mods_enabled" directory I am elated to discover a "deflate.load" file to claim as my very own.

So... two greulling hours to get two mods (one actually) enabled in Apache. Just one more system requirement to go: a PHP cache. I shall approach this task with less arrogance and more caution. Google tells me about APC (Alternative PHP Cache) and on php.net I immediately find exact instructions on how to install everything with just three commands in the shell:

for the PCRE requirement
sudo apt-get install libpcre3-dev

to install APC
sudo apt-get install php-apc

retart apache
sudo /etc/init.d/apache2 restart

Copy the file "apc.php" into the web docroot and call it in the browser to see configuration and statistics.

With nary a few googles I have completed the system requirements necessary before one even begins to install Typo3 for demonstration purposes. Evening is beginning to fall apon my first day on board the Hackership.


No comments:

Post a Comment

Play nicely!