Manually install an Akelos project in development

Akelos is a PHP Framework designed to be as close as possible to the Ruby on Rails framework, but in PHP.

When developing a web application with Akelos in a group of several developers, and until an installation procedure has been put in place, you might want to manually install the application from the sources. This document will take you through the step of doing just that. It is based on the asumption that you have a general directory with a copy of the Akelos repository and you own application as subdirectories.

First, make sure you have defined a Virtual Host in Apache to point to the main directory (the directory containing both Akelos and your application). This might be improved later on by only using the application directory, but considering we are still in the development phase, we don’t really care (do we?).

If you go to your Virtual Host with a web browser at this point, you will see that Akelos shows up with a wizard asking you to configure Akelos. This is not what we want. We don’t want to configure Akelos, we want to configure our application. Just leave this page as is.

Second, we want to create a configuration file and a route file to enable the retrieval of our application. Entering the config/ directory, you will see two files there, called DEFAULT-config.php and DEFAULT-routes.php. Make a copy of both under the names config.php and routes.php.

localhost:/var/www/myapp$ cd config

localhost:/var/www/myapp$ cp DEFAULT-config.php config.php

localhost:/var/www/myapp$ cp DEFAULT-routes.php routes.php

Now that you have those two new files, edit config.php.

localhost:/var/www/myapp$ vi config.php

In config.php, you need to update the three databases informations. If you don’t have a database user with permissions to create databases, you should make sure you prepare it before you go any further. Check the Akelos documentation to know more about the three databases. The idea is that you need one that has a meaningful name for the project for the production part. For example, if my application is called “myapp”, then my production database name could be “myapp”. My development database name could be “myapp_dev” and my test database name could be “myapp_test”.

Also make sure that the AK_FRAMEWORK_DIR constant defined at the end of the script is pointing directly to your akelos directory. In this example, the value would be: ‘/var/www/myapp/akelos’

To avoid noisy permission errors, you have to make the config/, tmp/, app/installers/versions/ and app/locales/ directories writeable by the web browser. You could do that ugligly by allowing anyone to write on these directories. Don’t do this in production environments!

localhost:/var/www/myapp$ sudo chmod -R 0777 config tmp app/installers/versions app/locales

That’s it. Now you need to generate the databases structure from the Akelos scripts.

localhost:/var/www/myapp$ ./script/migrate myapp install

In the event of having inclusion problems, like me, with constants.php, it might be that you haven’t read well my comment on the AK_FRAMEWORK_DIR constant above. Make sur you fix this and try again.

This should now give you a considerable amount of output, ending with something (if using MySQL) like:

(mysqlt): COMMIT
—–
—–
(mysqlt): SET AUTOCOMMIT=1
—–
Smart Commit occurred

localhost:/var/www/myapp$

Now, by pointing your browser to your Virtual Host, and possibly apending the name of a controller to your url, you should be able to start testing the current state of development.

It's only fair to share...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on TumblrEmail this to someone

Leave a Reply

Your email address will not be published. Required fields are marked *