1.2. Installation

Configure php.ini (optional)

The following PHP configuration directives are in fact all optional, but recommended. They can be set in either your global php.ini configuration file, or by making use of the php_flag within an .htaccess file placed in your application's document-root.

  • short_open_tag = Off (not absolutely necessary, but watch out for occurances of <? in your templates)
  • output_buffering = On
  • error_reporting = E_ALL | E_STRICT (not essential, but recommended to encourage clean code during development)
  • register_globals = Off (you really shouldn't have them on anyway!)

You may also add Buan's buan-core folder to your global include_path, eg:

include_path = ".;/usr/local/buan/buan-core"	# on Unix systems
include_path = ".;c:\usr\local\buan\buan-core"	# on Windows systems

Getting hold of the source files

As of this writing you can download Buan from a couple of locations:

  1. The subversion repository at http://svn.thundermonkey.net/jdg/buan/
  2. A daily snapshot of the subversion trunk at http://www.thundermonkey.net/builds/buan-trunk.tar.gz

Setting up the Buan core

Now you've got hold of the source tree, follow these instructions to get the core Buan files copied to the right directories and get Apache setup to access them.

  1. Copy the buan-core folder to any location on your server (preferably to a location that is not directly accessible via a URL) and note down the full path to this location as you will need it later. For the remaining instructions we'll assume you've copied it to:
    /usr/local/buan/buan-core
    
    Note: You may like to keep several versions of Buan running on the same server for use across a number of sites. In this case you could use something like /usr/local/buan-1.0.0/buan-core.
  2. Ensure that the user account under which Apache is running (commonly www) has full read/execute permissions on buan-core and all files/folders contained within. On Unix systems this can be done with the command:
    $ chown -R www:www /usr/local/buan/buan-core
    
  3. Add the following line in Apache's configuration file (usually httpd.conf) in either your site's VirtualHost block (to make it applicable to that site only) or in the global scope (to make it applicable to ALL sites on your server):
    # Create a URL alias to the buan-pub folder
    Alias /buan-pub /usr/local/buan/buan-core/buan-pub
    This simply creates a URL alias that will point to all the files within the /usr/local/buan/buan-core/buan-pub folder, eg:
    http://www.mysite.net/buan-app
  4. Add the following Apache directives (must exist outside of a VirtualHost block):
    # Allow public access to buan-pub
    <Directory "/usr/local/buan/buan-core/buan-pub">
      Order allow,deny
      Allow from all
    </Directory>
    

Setup your application

  1. You can create any directory layout you wish for your application, but here's a recommended layout for a first-time installation:
    /home/my-app
      /config
      /controllers
      /models
        /managers
      /public_html	# Your document root, it may be named differently on your system
      /views
    
  2. Copy all files from the buan-app/config folder into /home/my-app/config.
  3. Copy all files from the buan-app/public_html folder into /home/my-app/public_html.
  4. If you have not added the buan-core folder to your include_path directive in php.ini, then you will now need to open the gateway script /home/my-app/public_html/index.php in a text-editor and adjust the path in the require(...) command to point to the location of your buan-core folder. ie:
    require_once('/usr/local/buan/buan-core/Buan.php');
    
  5. Add the following directives to your Apache configuration file:
    # Allow scripts in the application's document root to use .htaccess files
    <Directory "/home/my-app/public_html">
      AllowOverride All
    </Directory>
    
  6. Load the application in your browser and you should see a welcome message. If not, consult the Troubleshooting section of the manual.