mirror of
https://github.com/cytopia/devilbox.git
synced 2024-12-19 12:57:52 +00:00
3.7 KiB
3.7 KiB
Setup CodeIgniter
Table of Contents
- local
Overview
The following configuration will be used:
Project name | VirtualHost directory | Database | TLD_SUFFIX | Project URL |
---|---|---|---|---|
my-ci | /shared/httpd/my-ci | my_ci | loc | http://my-ci.loc |
Walk through
It will be ready in eight simple steps:
- Enter the PHP container
- Create a new VirtualHost directory
- Download CodeIgniter
- Symlink webroot directory
- Add MySQL database
- Configure datbase connection
- Setup DNS record
- Visit http://my-ci.loc in your browser
available_tools
1. Enter the PHP container
host> ./shell.sh
work_inside_the_php_container
2. Create new vhost directory
devilbox@php-7.0.20 in /shared/httpd $ mkdir my-ci
3. Download CodeIgniter
devilbox@php-7.0.20 in /shared/httpd $ cd my-ci
devilbox@php-7.0.20 in /shared/httpd/my-ci $ wget https://github.com/bcit-ci/CodeIgniter/archive/3.1.8.tar.gz
devilbox@php-7.0.20 in /shared/httpd/my-ci $ tar xfvz 3.1.8.tar.gz
devilbox@php-7.0.20 in /shared/httpd/my-ci $ ls -l
total 7488
drwxr-xr-x 5 devilbox devilbox 4096 Mar 22 15:48 CodeIgniter-3.1.8/
-rw-r--r-- 1 devilbox devilbox 2205672 May 21 10:42 3.1.8.tar.gz
4. Symlink webroot
devilbox@php-7.0.20 in /shared/httpd/my-ci $ ln -s CodeIgniter-3.1.8/ htdocs
5. Add MySQL Database
devilbox@php-7.0.20 in /shared/httpd/my-ci $ mysql -u root -h 127.0.0.1 -p -e 'CREATE DATABASE my_ci;'
6. Configure database connection
devilbox@php-7.0.20 in /shared/httpd/my-ci $ vi htdocs/application/config/database.php
<?php
$db['default'] = array(
'dsn' => '',
'hostname' => '127.0.0.1',
'username' => 'root',
'password' => '',
'database' => 'my_ci',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
7. DNS record
If you do not have setup_auto_dns
configured, you will need to add the following line to your host operating systems /etc/hosts
file (or C:\Windows\System32\drivers\etc
on Windows):
127.0.0.1 my-ci.loc
howto_add_project_dns_entry_on_mac
howto_add_project_dns_entry_on_win
setup_auto_dns
8. Open your browser
All set now, you can visit http://my-ci.loc in your browser.