The following step-by-step installation procedure is the same as documented in Community Auth’s readme.


1 Put the community_auth package in CodeIgniter’s application/third_party directory.

2 Verify that extensions in community_auth/helpers and community_auth/libraries do not conflict with extensions you already have made in your application. You’ll need to merge any conflicts if they exist, and then eliminate one of the files.

3 Copy files from community_auth package to CodeIgniter’s application sub-directories.

  • If on linux or mac, if there is no existing application and no reason to worry about overwriting existing files, use the terminal and cd to the application directory, then execute ./third_party/community_auth/sh/, then skip to step 8. You will probably need to set permissions of to allow execution. After execution, remove permissions to execute or remove the file completely.
  • If not on linux or mac, or if you already have an existing application, proceed to step 4.

4 Copy MY_Controller.php, MY_Input.php, and MY_Model.php from community_auth/core to CodeIgniter’s application/core directory. If you already had these files, merge them with your existing files.

5 Copy the Examples and Key_creator controllers in community_auth/controllers to CodeIgniter’s application/controllers directory.

6 The .htaccess file in community_auth/public_root can be moved to CodeIgniter’s public root directory. Notice the lines at the top that allow for access denial. If you already have an .htaccess file, make sure to include those lines at the top of it.

7 If the site has a security certificate, change value of USE_SSL to 1 in application/hooks/auth_constants.php. While you are there you should review the other constants, as all are configurable.

8 Add route to login page in config/routes:

$route[LOGIN_PAGE] = 'examples/login';

9 Define Community Auth hooks by adding them to config/hooks.

$hook['pre_system'] = array(
	'function' => 'auth_constants',
	'filename' => 'auth_constants.php',
	'filepath' => 'third_party/community_auth/hooks'
$hook['post_system'] = array(
	'function' => 'auth_sess_check',
	'filename' => 'auth_sess_check.php',
	'filepath' => 'third_party/community_auth/hooks'

10 While not critical for basic Community Auth usage, check out and configure community_auth/config/authentication.php as needed.

11 Database:

  • Create a database if not already available.
  • Run the SQL located in community_auth/sql/install.sql.
  • Configure CodeIgniter to use the database in config/database.php.

12 Enable hooks and make sure there is an encryption key set in config/config.php. Community Auth provides a Key_creator controller for an easy way to set a valid encryption key. A 128 bit encryption key is recommended.

13 Create a user for testing purposes by editing the user_data array that is inside the create_user method, which is in the Examples controller. When specifying a auth level, be aware of the “levels_and_roles” array located in config/authentication. In order to login in the next step the auth level must be set to 9, which by default is an admin. Also note that this method of user creation does not account for password strength, yet the login validation does. A password that is strong enough will have an uppercase letter, a number, and be at least 8 characters long. To create the user, request the examples/create_user URI in your browser:

  • /index.php/examples/create_user if you are not using mod_rewrite to remove index.php.
  • /examples/create_user if you are using mod_rewrite to remove index.php.

15 If you did everything right, you should be able to go to the examples/index URI and login with the user you just created:

  • /index.php/examples if you are not using mod_rewrite to remove index.php.
  • /examples if you are using mod_rewrite to remove index.php.

16 Loging out is as follows:

  • /index.php/examples/logout if you are not using mod_rewrite to remove index.php.
  • /examples/logout if you are using mod_rewrite to remove index.php.