mirror of
https://github.com/cytopia/devilbox.git
synced 2024-12-22 14:12:25 +00:00
3.8 KiB
3.8 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
tutorial_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 global_configuration_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
For in-depth info about adding DNS records on Linux, Windows or MacOS see: project_configuration_dns_records
or global_configuration_auto_dns
.
8. Open your browser
All set now, you can visit http://my-ci.loc in your browser.