Menu

yfi_setup_cake

Anonymous

Set-up CakePHP

Introduction

  • YFi Hotspot Manager consists of two components: A CakePHP application and a Viewer.
  • This page will help you to configure the CakePHP application.

Requirements

A note on Ubuntu 10.4 and CakePHP 1.3.x

  • Thanks to all who reported, tested, documented on the latest versions.
  • CakePHP 1.3.x and its Authentication component does not work correct with Internet Explorer 7 (IE-7).
  • You are encouraged to use CakePHP 1.2.x and NOT 1.3.x because of the Internet Explorer bug.
  • Please report any issues you may experience on this newer versions on the forum.

Component
Description

Operating System
Ubuntu 10.04 (Lucid Lynx) or greater

Web Server
LAMP Stack

CakePHP
CakePHP version 1.2.7 or greater (as of 05/15/10 CakePHP 1.3.x is not yet supported)


Install the LAMP stack

  • It is assumed that you have sudo rights on the Ubuntu machine which you want to install YFi Hotspot Manager on.

  • From the terminal enter the following command:

    sudo tasksel
    
  • Selecting LAMP from the list will install all the required packages.

  • You will be required to supply a password for the root mysql user. (Hitting Esc each time will create a blank password)

  • Ensure the PHP command line program is also installed by issuing the following command:

    sudo apt-get install php5-cli
    
  • Install imagemagick which is used to scale graphic files

    sudo apt-get install imagemagick
    
  • Install the following two PHP packages for new enhancements:

    sudo apt-get install php5-gd php5-curl
    

Install Language Packs (optional)

  • From release Beta-3 upwards, YFi Hotspot Manager supports multiple languages

  • Install the following optional language packs in order to ensure proper working for the supported languages.

Language
Command to install language pack

Afrikaans
sudo apt-get install language-pack-af

French
sudo apt-get install language-pack-fr

Indonesian
sudo apt-get install language-pack-id

Malay
sudo apt-get install language-pack-ms

Netherlands
sudo apt-get install language-pack-nl

Thai
sudo apt-get install language-pack-th

Spanish
sudo apt-get install language-pack-es

Portuguese
sudo apt-get install language-pack-pt

German
sudo apt-get install language-pack-de

Danish
sudo apt-get install language-pack-da

Italian
sudo apt-get install language-pack-it

Persian (Farsi)
sudo apt-get install language-pack-fa

  • Or just install them all at once

    sudo apt-get install language-pack-af language-pack-fr language-pack-id language-pack-ms language-pack-nl language-pack-th language-pack-es language-pack-pt language-pack-de language-pack-da language-pack-it language-pack-fa
    

Install CakePHP

  • Download the latest version of CakePHP (Version 1.2.11 as of this writing) (as of 05/15/10 CakePHP 1.3.x is not yet supported) Get CakePHP

  • Copy and extract it inside the directory that Apache is serving its content from (/var/www by default on Ubuntu)

    sudo cp cakephp-cakephp-1.2.11-8-ga9b5b0c.zip /var/www
    cd /var/www
    sudo unzip cakephp-cakephp-1.2.11-8-ga9b5b0c.zip 
    sudo ln -s ./cakephp-cakephp-a9b5b0c ./c2
    
  • Enable the rewrite Apache module, also enable the compression module and the module that modifies the HTTP headers, they are used to vastly improve speed and performance of the web application. Reload Apache's configuration.

    sudo a2enmod rewrite
    sudo a2enmod deflate
    sudo a2enmod headers
    sudo /etc/init.d/apache2 reload
    
  • Edit the following line in the '/etc/php5/apache2/php.ini' file

    sudo vi /etc/php5/apache2/php.ini

  • Change [Line Number: 101]

    output_buffering = Off

To

output_buffering = 4096
  • Also ensure short_open_tag is activated in '/etc/php5/apache2/php.ini' [Line Number: 83]

    short_open_tag = On
    
  • Change Apache's configuration file to include the following: ('/etc/apache2/apache2.conf')

    sudo vi /etc/apache2/apache2.conf

    <Directory var="" www="" c2="">
    AllowOverride All
    </Directory>

    -------COMPRESS CONTENT-----------

    place filter 'DEFLATE' on all outgoing content

    SetOutputFilter DEFLATE

    exclude uncompressible content via file type

    SetEnvIfNoCase Request_URI .(?:exe|t?gz|jpg|png|pdf|zip|bz2|sit|rar)$ no-gzip

    dont-vary

    Keep a log of compression ratio on each request

    DeflateFilterNote Input instream
    DeflateFilterNote Output outstream
    DeflateFilterNote Ratio ratio
    LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
    CustomLog /var/log/apache2/deflate.log deflate

    Properly handle old browsers that do not support compression

    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4.0[678] no-gzip
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

    ----------------------------------

    ------ADD EXPIRY DATE-------------

    <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$"="">
    Header set Expires "Thu, 15 Apr 2015 20:00:00 GMT"
    </FilesMatch>

    ----------------------------------

    --------Remove ETags --------------------

    FileETag none

    -----------------------------------------

  • Reload Apache

    sudo /etc/init.d/apache2 reload
    

Install YFi CakePHP Application

  • Download the latest version of the YFi Cake application. Get YFi CakePHP

  • If you want to try the latest development source, follow this instructions: SVN Quick Help

  • Extract it inside the '/var/www/c2' directory.

    sudo cp [ latest version of yfi_cake ].tar.gz /var/www/c2
    cd /var/www/c2
    sudo tar -xzvf [ latest version of yfi_cake ].tar.gz
    sudo chown -R www-data. /var/www/c2/yfi_cake/tmp
    sudo chown -R www-data. /var/www/c2/yfi_cake/webroot/img/graphics
    sudo chown -R www-data. /var/www/c2/yfi_cake/webroot/files
    

Configure the database

  • You need to create a database called 'yfi' and allow access to it for a username / password combination.

  • It is good practice to change the default username / password combination.

  • This can be changed inside the '/var/www/c2/yfi_cake/config/database.php' file.

  • These sample commands assume the defaults.

    mysql -u root
    create database yfi;
    GRANT ALL PRIVILEGES ON yfi.* to 'yfi'@'127.0.0.1' IDENTIFIED BY 'yfi';
    GRANT ALL PRIVILEGES ON yfi.* to 'yfi'@'localhost' IDENTIFIED BY 'yfi';
    exit;
    
  • Dump the sample database in the newly created yfi database.

    mysql -u root yfi < /var/www/c2/yfi_cake/setup/db/yfi.sql
    
  • If you use the latest SVN code be sure to patch the SQL also to contain the latest changes.

    mysql -u root yfi < /var/www/c2/yfi_cake/setup/db/beta-5_to_beta-6_patch.sql
    

Test the CakePHP application

  • Verify that everything works as intended by doing the following test.

  • Go to the followingURL and be sure that a login-page is displayed.

http://127.0.0.1/c2/yfi_cake/users/


Tweaking the configuration

  • Some settings may need further tweaking especially if you deviated from the standard.

  • They are all in one configuration file called (/var/www/c2/yfi_cake/config/yfi.php)

  • You also need to specify the SMTP server's detail.

This can be used to notify users about their usage via e-mail. YFi Hotspot Manager also features a message sending facility to inform permanent users about something.


Next Step

Continue by installing the View component. Viewer Instructions


Related

Wiki: Home
Wiki: yfi_setup_svn
Wiki: yfi_setup_yfi