2014年7月1日 星期二

CodeIgniter Installation

1. download CodeIgniter 3.0 release from github


2. extrace all the file into /var/www/html/CI



3. to remove index.php (http://127.0.0.1/Test instead of http://127.0.0.1/index.php/Test

A: modify httpd.conf, add a virtualhost with  AllowOverride All

B: in /var/www/html/CI , add a .htaccess with rewrite rule
RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.php|images|assets|robots\.txt|$)
RewriteRule ^(.*)$ index.php/$1 [L,QSA]


C: modify config.php and set index_page to blank
$config['index_page'] = '';

4. In   /var/www/html/CI/application/controllers  

add a Test.php
class Test extends CI_Controller {

        public function index()
        {
                echo 'Hello World!';
        }
}
?>

Browser : http://127.0.0.1/Test  or http://127.0.0.1/index.php/Test



5. Install Ion Auth 2

download Ion Auth 2 from https://github.com/benedmunds/CodeIgniter-Ion-Auth

copy controllers / language / libraries / models / views to /var/www/html/CI/application
rename  files to support V3 UpperCaseFirst class name


config/ion_auth.php               =>   config/Ion_auth.php
models/ion_auth_model.php         =>   models/Ion_auth_model.php
models/ion_auth_mongodb_model.php =>   models/Ion_auth_mongodb_model.php
execute sql

remember to set Selinux , httpd_can_network_connect_db
setsebool -P httpd_can_network_connect_db 1

Browser : http://192.168.1.155:8080/Auth/

and Login with default email and password

6. Add CSS / JS Folder

mkdir /var/www/html/CI/assets
mkdir /var/www/html/CI/assets/css
mkdir /var/www/html/CI/assets/javascript

make sure in the .httaccess
RewriteCond $1 !^(index\.php|images|assets|robots\.txt|$)

in the view
<link type="text/css" rel="stylesheet" href="/assets/css/test.css" media="all" />

沒有留言:

張貼留言