Tuesday, November 12, 2013

Day 2: setting up the environment... still.

As continued from the previous day, with less nonsense.

Since I'm too exhausted today for literary flourish, let's review the previous day's discoveries in light of the knowledge I was fortunate enough to gain today. This time with a lot less adjectives.

System requirements for installing Typo3:

1) Image Magick - I found out today that this is NOT installed, but could remedy that easily with:

sudo apt-get update
sudo apt-get install imagemagick --fix-missing

2) GDLib / Freetype - these were already available in my PHP installation, which I found out by using:

php -i

Alternatively, you can open a PHP page in the browser that contains the function call "phpinfo()".  This will tell you EVERYTHING you need to know, and possibly more than you would like to, about your PHP and your Apache configurations.

3) zlib - same as #2

4) Apache with mod_deflate (NOT mod_gzip!) and mod_rewrite.  Initally I used

apache2 -l

(sort of), to find this out. Today I found out a more convient way to check out the Apache configuration, as referred to above in #2. This is a much, mush easier way to find out, and more readable.

To install mod_rewrite, though, just do this:

sudo a2enmod rewrite

You don't need to install mod_gzip - it is for a previous version of Apache.  The correct mod is mod_deflate.  I contacted Typo3 documentation about this and they quickly wrote back that the correction is slated to be updated very soon.

5)PHP Cache (I used APC) - this was trivial to install:

sudo apt-get install libprcre3-dev php-apc
sudo /etc/init.d/apache2 restart

Copy the file "apc.php" into your web docroot and call in the browser to see some pretty graphs.

Today I spent several hours trying to concentrate on the task at hand: install Typo3. Some of that time was spent moping after I got stuck with the incredibly informative "Server Error"... error after installation.  But let's start at the beginning:

Download the Typo3 introduction package from typo3.org and unpack it to your web docroot.  This simple task took me 20 minutes, since the first download ended up being corrupted, and lack of root permissions in my web docroot forced me to revert to the command line to get things done (unzip, rename, create files, change file permissions).  Being forced to use the command line is a good thing, though - our childrens can are learning.

Calling the main install tool page, however, turned out to be my initiation of the day into a world of pain.  As expected, I was told that the install tool is locked and that I need to create an empty file called ENABLE_INSTALL_TOOL. This took a LONG time to figure out how to do, since even using

sudo cat /dev/null > ENABLE_INSTALL_TOOL

to create an empty, theoretically "extensionless" file caused the command line to tell me that I had no permissions. As root.  After a LOT of googling I learned that by first using

sudo su -

"you start an interactive shell AS 'root'".  I thought that's what preceding commands with "sudo" was supposed to be for, but whatever.  After that I could create the necessary file.  Ubuntu insisted on making it a text file, which I thought was the cause of the subsequent problem, the incredibly informative "Server Error", which I got when calling the installation page anew.  I looked everywhere on how to create an EXTENSIONLESS file, not a file that automatically gets saved as a text file.

After about 2 hours of this, I gave up and spent 30 minutes reviewing PHPUnit.  One of the organisers asked me how I was doing and I told him that I was stuck and showed him the problem.  He recommended checking out the apache error log in var/log/apache2/error.log, which informed me that the file typo3conf/LocalConfiguration.php was not writable. That was the problem, not that my ENABLE_INSTALL_TOOL file was automatically saved as text. The LocalConfiguration.php file didn't even fracking exist.  I'd already checked the write permissions on the directories and they were all OK. So he suggested listing the running processes and their owners to see if perhaps the owner of Apache did not match the owner of my web docroot. The command line to do this is

ps aux

which is totally AUXSOME. Apache claimed to be pwnd by "www-data", which was the key to why the file "LocalConfiguration.php" (which did not exist) could not be written, as the web docroot directory was owned by root.

We used "man" on the command line to check the correct syntax for "chown", which can be used to change the owner of a directory. After that we just had to navigate to the webroot directory and use

chown -R www-data .

in order to change the owner of web docroot recursively (i.e. all of web docroot's subdirectories) to "www-data", which would make all of these directories pwnable by www-data and thus enable the install TOOL to create the LocalConfiguration.php file.

After doing this, the installation page for Typo3 opened, as did the Gates of Heaven!

I found out after some grumbling over a "non-existent" database that I needed to call the install tool page with the argument "mode=123" in order to enter the non-existing database's information. I changed the site password, gave it a My Little Pony Periwinkle color, and everything was peachy (lavender) after that.

Sidenotes: in the principle of "always improve your environment", is there some kind of tool for checking the apache2 log visually?

A few minor issues are still nagging me, though, like "too low PHP script execution time", and the fact that email doesn't fracking work.  I know that these things can be changed in php.ini, but what about the "too low maximum file size" which, according to the TOOL, can be set with the parameter "TYPO3_CONF_VARS[BE][maxFileSize]".  WHERE one is supposed to do that, TOOL has failed to mention. I had to post it on a blog in hopes of getting my answer.

Yet another day at sea, and once again the day is saved but by the sage advice of a fellow seamate.  As Herman Melville once said, "he who sails alone, sails but to his death".

Actually no - Herman Melville never said that.  I just totally made it up.

No comments:

Post a Comment

Play nicely!