Codeigniter htaccess for mac, linux and godaddy hosting server

From codeigniter if you want remove index.php from url first you need to edit config.php file from config directory like

and then you need to create htaccess file with mod_rewrite module enable. Edit htaccess file look like :

Mac OSX Environment:

Linux OS Environment :

Godaddy Hosting Server:

Thats now you will see your site url without index.php :)

MySQL query with if else condition

MySql query with if-else condition:

Here’s the statement:


Using wkhtmltopdf and ImageMagick make pdf and image

Setup wkhtmltopdf in ubuntu:

Setup ImageMagick

create pdf :

create image :

Codeigniter CSRF with AJAX

Thats the very important issue when you enable csrf protection for security reason in codeigniter framework based project then you must face some problem ajax related. So here’s the code how to resolve it :

How to Create Select field using Zend Framework2 Form

First I  Create Form Class name CategoryForm.php in Form directory. Source Code

In Controller i add this lines:

In view file i add this line :


Codeigniter pagination style with twitter bootstrap pagination

I want to style my pagination view with twitter bootstrap style and i used codeigniter php framework and twitter bootstrap. First i create controller name is front  and action is news.

Then in view page write this code:

After that my pagination look like twitter bootstrap pagination components.

Get date after 1 week from current date or specific date

In my project i need find after 7 days or 1 week later date from current date or specific date.So this purpose i need to get after 7 days date form current or specific date.

Here’s my php code :

how to install LAMP – Apache, MySQL & PHP on Ubuntu 11.10

LAMP : Linux Apache MySQL, PHP/Perl but in that case P : = PHP.  This is totaly open source stack. I follow this step –

step 1. Installing Apache

Open terminal (press Ctrl+Alt+t) and execute the command -

Then Open browser and type http://loacalhost. See It Works page ..


step 2. Installing MySQL

Execute this command in terminal (Ctrl+Alt+t) :

In installation process need set password for mysql administrative user.

step 3. Installing PHP

Then restart the apache server to load php modules. Write following command in Terminal -

After all process complete that’s ok.

To manage MySQL database from a GUI, You may like to install phpMyAdmin – The MySQL web administration tool, a great application for managing – creating and maintaining MySQL database.

Install phpMyAdmin on Ubuntu 11.10

just execute the command  in your terminal -

on install process you need select web server such as >> apache2 and >> lighthttp.
Enter mysql root user password and phpmyadmin password.

Then finish….