Updating Trackstar To Yii-1.1.13 Mysql 5.5+

("non-issues" edited and explained 2013-03-25)

I’m learning Yii and having trouble getting TrackStar running on FreeBSD with Apache. If anyone knows what magic dust to sprinkle on Apache, please let me know.

I started with a zip download of the full trackstar/ app from Winesett’s trackstar repo on GitHub (using it with yii-1.1.13 instead of YiiRoot/ in the repo). The code on GitHub has the code from the book errata, compared to the chapter code in the download bundle. I tested locally first (Windows XAMPP 1.8.1, PHP 5.4.7, MySQL 5.5.27), then moved to a FreeBSD server.

At first locally, yiic and phpunit didn’t behave as expected, but it was my fault. I edited trackstar/index.php to use yii-1.1.13, but forgot to also edit trackstar/protected/yiic.php and trackstar/protected/tests/bootstrap.php (and for completeness, also trackstar/index-test.php).

Also, I also didn’t understand that “yiic shell” is intended to be run from the application root (i.e. trackstar), as is expects the application’s index.php in the current working directory.[/i]

  1. I had to change truncateTABLE to delete in two migration scripts to eliminate errors migrating down (MySQL 5.5+ can’t truncate InnoDB tables with foreign keys).

  2. TrackStar now runs, but you can’t login because there are no users in the database. I manually added “User One” and “User Two” users via SQL as per the book (ebook p.123).

  3. Now I can login now as either "User One" or "User Two", but there are errors creating new projects (there are new projects being created in tbl_project though). Running "yiic rbac" fixes the project creation errors.

Now, I can not only login but also create projects, issues and comments, and assign users to projects. TrackStar rocks!

  1. Next, I copied TrackStar from Windows/XAMPP to a FreeBSD server (PHP 5.4.10 MySQL 5.5.30) with yii-1.1.13. I had to change the connection string in main.php and console.php from host=127.0.0.1 to host=localhost for the migration scripts to run, and the main page to load.

  2. The TrackStar main page now loads, but navigating with the menu results in a 404 error "The requested URL /usr/local/www/trackstar/index.php was not found on this server.". Is this related to URL rewriting? Is my Apache trackstar.conf file misconfigured?


casper# cat /usr/local/etc/apache22/Includes/trackstar.conf

Alias /trackstar "/usr/local/www/trackstar"


<Directory "/usr/local/www/trackstar">

    Options Indexes FollowSymlinks +Includes

    AllowOverride All

    Order allow,deny

    Allow from all

</Directory>

casper# 

SOLVED! Search the forum for “Problem with .htaccess” (topic 15694, I’m still a newb here so I can’t link to it).

The .htaccess file with TrackStar assumes (and requires) that trackstar is served from the root of the web server (myserver/), when I need myserver/trackstar. I don’t know why it worked locally on XAMPP with the original .htaccess (but figuring it out is on my ToDo list).

My final .htaccess file:


# Turning on the rewrite engine is necessary for the following rules and features.

# FollowSymLinks must be enabled for this to work.

<IfModule mod_rewrite.c>

  Options +FollowSymlinks

  RewriteEngine On

</IfModule>


# Unless an explicit file or directory exists, redirect all request to Yii

# entry script

<IfModule mod_rewrite.c>

  RewriteCond %{REQUEST_FILENAME} !-f

  RewriteCond %{REQUEST_FILENAME} !-d


  RewriteRule ^.*$ /trackstar/index.php

</IfModule>

and final trackstar.conf FWIW


Alias /trackstar "/usr/local/www/trackstar"


<Directory "/usr/local/www/trackstar">

    Options All

    AllowOverride All

    Order Deny,Allow

    Deny from All

    Allow from All

</Directory>