Getting started with Solar

Solar is a web application framework written in PHP. It follows the general Model View Controller (MVC) design pattern so those familiar with other MVC-based frameworks will have a pretty easy time figuring out how it works.

There are some good Getting Started documents on the Solar website. Much of this is taken from there with some elaboration.

Keep in mind that Solar is still in an alpha state, so you might not want to use it on production web sites. There are some changes coming in the next release which will make some of the documentation obsolete.

Getting started with Solar is quite straightforward so long as you have PHP 5 and a Linux environment to work with. I am pretty sure it will work in a Windows environment, but the Solar *system* relies on symbolic links, which Windows doesn’t support (although, I think Vista has some sort of symbolic link support). If using Windows, you might have to do some more manual setup and the command line scripts may not work. Finally, let’s hope you are running Apache, or something close to it.

Typically, you are going to want to extract the downloaded tarball somewhere outside of the web server’s document root. Your file system after extraction might look like this:

/home/username/www/docroot/ (your current web server document root)
/home/username/www/solar/index.php (typically ignored)

Now, because your solar install is outside of your document root, you have to tweak the web server’s configuration so that it can find the happy and joyful Solar goodness. There are certainly a few ways to do this. To me, the easiest is to use an alias in the Apache configuration. Most Apache installs should have a conf.d directory. Mine is in /etc/apache2 on my Ubuntu machine. To get an alias to your new Solar docroot, create a new file in the conf.d folder called aliases.conf.

username@host:~$ sudo vim /etc/apache2/conf.d/aliases.conf

Then add a line similar to this at the top of that newly created file:

Alias /solar "/home/username/www/solar/docroot"

Save and close the new file and restart your web server:

username@host:~$ sudo /etc/init.d/apache2 restart

One thing I didn’t mention is that you will probably have to add a directive to your Apache configuration to make this set up work.

<Directory /home/username/www/solar/>
Options Indexes FollowSymLinks
AllowOverride All
Order deny,allow
deny from all
allow from

You should be almost ready to go, but WAIT! There are a couple more things to do. You have to set the correct permissions on a couple of folders in the solar system.
chmod -R 777 sqlite
chmod -R 777 tmp

Also, because you are not using the web server’s defined document root, you might have to alter one or two more files. If you have mod_rewrite enabled on your Apache server, then open up the /solar/docroot/.htaccess file and add this:

RewriteBase /solar

Directly after the line that reads RewriteEngine On.

You will also see a line that reads:


You can either change it to

Or, do what I do and comment it out or remove it completely


I like to keep this setting in my config file. So, let’s edit that file now. Open /solar/config/Solar.config.php and add a couple of lines after the first line that defines $system.

// Base action href
$config['Solar_Uri_Action']['path'] = '/solar';
// Base public directory href
$config['Solar_Uri_Public']['path'] = '/solar/public';

Now, you should be ready to rock and roll. If your your web server is running on localhost, go to


You should see Hello World!

Next time, we’ll follow the examples from the Solar manual on setting up a simple application.