Post 22: CodeIgniter (Removing index.php file)

When using CI (PHP Framework), you will notice that CI includes index.php in the URL for any link to any file.  When you search for this issue by typing: “ci remove index.php from url”, you will see the link to Ellislab user guide  that describes how to fix or solve it as shown in the image below:

image for CI Help
image for CI Help

Now the explanation is very simple and clear, but unfortunately is not complete! In this post, I will try to show you what I’ve learned and did to get my project links to work without including index.php in the URL.

When you first install CI, you will notice the .htaccess file is inside a subfolder called “Application”. You need to move it (.htaccess) to the root folder of your project. For example, if your CI website is inside a subfolder named “myproject”:, .httaccess has to be inside myprojet folder (directory).

Open .htaccess, clear it then write or copy the following code:

RewriteEngine On

RewriteBase /myproject/

RewriteCond %{REQUEST_URI} ^system.*

RewriteRule ^(.*)$ /index.php?/$1 [L]

RewriteCond %{REQUEST_URI} ^application.*

RewriteRule ^(.*)$ /index.php?/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php?/$1 [L]

ErrorDocument 404 /index.php

Notice that in the second line of the code, the CI website name is myproject. You need to change it based on your project root folder name.

Open config.php file here is the path for this file:



You will see the following comment plus $config[‘base_url’]

// the config[base url] file is the root folder name and anything before that:

Change the value of $config[‘base_url’] to:

For localhost (on your pc):
$config[‘base_url’] = ‘http://localhost/myproject/’;

For your online server:
$config[‘base_url’] = ‘’;


In the same file (config.php), you will see the line: $config[‘index_page’] = ‘index.php’;

Remove the index.php as shown below:

$config[‘index_page’] = ”;

I assume you have your main navigation links inside php template file named header, navigation, or any name you chose. You need to change the links in your main nav to look like this:

<li><a href=”<?php echo base_url();?>mainsite/home”>home</a></li>

mainsite is your main controller name
home is the function name inside your mainsite controller that load home page from the view folder

And that’s it, I hope my post was helpful and easy to understand

Post 21: Remote SQL Connection

When we start creating a database driven website using PHP, the first thing we do is testing our application using the local host package like: WAMP for windows, MAMP for mac, or XXAMP for both. In the early stages of development workflow we might need to create a local database with simple tables using PHPMyAdmin locally, but when the application is growing larger and when the time is came to start developing and testing the project using our servers, we have to connect to a remote MySQL database. Due to many hosting providers, there are different ways to configure that type of connection, or finding the right IP address for our own servers.

Through my search earlier in the last semester, I found the table that contains a list for most of the hosting companies from and it could be useful for many PHP developers, below is just a sample for GoDaddy and you can visit the actual page in that contains the entire hosting.

GoDaddy – cPanel Hosting:  localhost
GoDaddy – Plesk Hosting: Use the IP address shown in the Databases Section in Plesk. Do not include: 3306

If your hosting company using cPanel which is built on Linux platform, in this case, we need to enable remote MySQL from cpanel in order to connect our PHP files that are running on our PCs using local Apache server with the MySQL database on the server. By enabling remote database, I mean adding the IP address for your computer to the web server host list in cpanel.

In windows, there are different ways to know your IP address by following either one of the following steps:

First Way:  using CMD

  • Go to run command and type: CMD to open command prompt window


  • Type: ipconfig and this will list the info of your network connection.
    The value that we are concerning about is IPv4 Address: XXX.XXX.X.XX.


Second Way:

  • Go to Control Panel then type Adapter in the search box.
    From the search result, double click the View Network connections to open your network if it’s Ethernet or Wi-Fi, network
  • Double click the one that in use (the activated one)
    From the Wi-Fi / Ethernet Status window, click on details and you will see the value of IPv4 Address for your current PC.

By the way, if nee to know IP address for your URL, you can also open the CMD window and type: ping Or when you login into your cpanel you will see in the left pane Shared IP Address which is the same.

Finally, you need to log into your cpanel ( to add your PC IP address as a remote web server to communicate with the database in your hosting company. And to do that, you can double click the remote MySQL server, then type your IP address in the box and click Add Host button as shown below:



Post 20: Safe Your Surf

Based on the requirement for this semester, is to create a blog about any topic. in this post for today, I would like to share with you the post that I am going to put in our blog website:

My blog is not dedicated for advanced or IT users, it is mainly written for general users even if they have very basic knowledge in using the computer. I am not trying to advertise for any product or company, I just like to share some useful tips with you based on my experience. Surfing the internet is interesting for any user but at the same time, it could be frustrating when you click or visit a bad website by mistake. Now, there are few simple rules or methods you can follow to protect yourself or your family from those type of websites.

First, when using WI-FI connection at home (to connect your computer to the internet without using cables or wires through a wireless modem), you need to have a strong password that not easy for intruders to guess. I still see some people using their home phone, for example, to be their password or their family names, yes because it is easy to remember and cannot be forgotten but still it’s easy for others also if they try to connect using your network. So try to come with a password that contains a combination of upper/lower case letters, symbols, and number. Remember that you need to follow the rules for any password like for your email or Facebook account for example.

Second, please you have to install an antivirus and make sure it’s up to date. Some people install two antivirus software believing that this will better protect their computers! No on the contrast, there will be a conflict between the two and each one might see the other one as a virus and for sure having two antivirus software will reduce the speed of your computer and will lead eventually to reduce its performance. There are lots of Internet Security software available, some of them are with your internet service provider but you might need to pay for adding this extra feature to your service or buy a one-year antivirus SW from a trusted company.

I know this could be expensive if you need to buy all-in-one SW like Internet Security as they are not always on sale. However, if you don’t need to buy, you can go with the free ones. There are many trusted companies that provide free versions of their commercial ones, of course, it doesn’t have all the entire features like the paid one but it’s definitely better than nothing or an expired one.

Personally, I tried MSE (Microsoft Security Essentials), which is provided by Microsoft and it’s live update. Being the Tech person in my company, I installed this SW in all the computers in my lab and I’ve been using this for more than 4 years. As I said there are other free SW like AVG, or AVAST, it’s a personal reference go and install one of them if you don’t want to buy.  Notice that Windows 8 is shipped with an installed version MSE, just the name is Microsoft Windows Defender.

One of the most common problems I found frequently when I receive a defected PC, is the user saw a pop-up message on their screen telling them that their computer is at risk and they have to install this antivirus or whatever to fix the problem. These types of flashy images are totally fake and you need to remember that since you have an antivirus already installed never and ever trust these kinds of messages. Now don’t mixed them with the real one from your own SW, as sometimes when your installed protection SW comes to end or near to the expiry date you will see pop-window reminding you to update or upgrade it, but these warning messages are easy to recognize as they are in windows environment not from a website and it contains the same name, logo, and interface (Same Theme) of your installed Protection SW.

I like to use another add-on to my browser called WOT (Web Of Trust), I know some users might not agree with me as adding this feature will reduce the loading speed of your browser and there are different reviews about WOT, but I found it useful in some cases. WOT is free software that you can install it for your browser, you have to specify which version you need to install based on which browser you use. WOT has a different version for each individual browser. When you search for a topic you will see colored circles beside each result in your web search, these colors have values, for example, green for trusted website and red for the bad one. Sometimes when you click on a link this link might take to a bad website, WOT will give you a warning message to leave this website. Notice also that many of well-known commercial protection software have this feature included.

Finally, excuse me for my long post, it’s not easy to include every single detail in this post but I hope this will be helpful for many.

Post 19: PHP Project

In my previous post, I talked about the main requirement for the last semester in the program which is to create a web project using any framework. Among the many PHP frameworks, I chose CodeIgniter (CI) for some reasons that were already mentioned before. The project that I am willing to build is to create a web application to manipulate the main statics formulas:

  • The mean (average)
  • The standard deviation
  • The variance
  • The mode
  • The median

The user can enter some values and choose any formula from the above list and the app will give the result based on the rules of each formula that have been chosen by the user. This is just a general idea and I am not sure how far I can go with this project in a short time with other assignments and required documentations. Anyhow, I will try my best to create something good, and whatever features I finish in this project will definitely sharpen my skills in PHP and enhance my knowledge in using CI framework.

I was in my second year at the university, the last semester also in 1996 when I come up with an idea to create that project. We had a course for math and statics, and as a student I liked to combine what I learned in that statics classes with my programming skills to create the application. At that time, there were no subjects called web application, PHP, or ASP, I had to create it using C language on MS-DOS platform. I couldn’t imagine that one day after all these several years, I will create a similar project and implement the same idea again here in Canada!

I haven’t started coding the formulas yet, I just prepared the wireframes, resources, Photoshop mock-up, database tables, and the front-end responsive layout. I am still working on learning CodeIgniter itself, I feel that I am in need to have a fully understanding of all the details and the functionality of this framework before start digging deep into implementing my code.

Understanding clearly the rules, tools, or the language we are going to use is very necessary and it can save us some headache down the road, that’s why I like Abraham Lincoln’s quote:

“Give me six hours to chop down a tree, and I will spend the first four sharpening the ax.”

Post 18: PHP Frameworks:

Hello again, we started the last semester for the Web Development program last week. In this semester we have to create our final web project using any framework. Since I liked to create my project using PHP, I had to make my decision to choose one of the many available PHP frameworks. Last week I spent too much time in researching for the most appropriate one to start developing the project.

I found that the most commonly used PHP frameworks are: Laravel, CodeIgniter (CI) and Zend.  Laravel, the brand new framework, has started to move quickly and there is no doubt that it will become the most commonly used especially for freelancers if it did not become already. Zend is used by many organizations and it’s for large corporations. When I used indeed website for job searching I found that there are many jobs posting requesting Zend, but this framework has a steep curve learning compared with the lightweight frameworks like CodeIgniter or Laravel. For sure, having the skills of using more than one framework is not a bad idea as job requirements can differ from one company to another. Personally, I chose CodeIgniter for the time being to build my PHP project, since CI has been in the market for a while, it has a very good documentation, community

Personally, I chose CodeIgniter for the time being to build my PHP project, since CI has been in the market for a while, it has a very good documentation, community’s support, and online tutorials. These will be very helpful for someone who is using a framework for the first time and needs to create a web project in a short time. After mastering CodeIgniter, Laravel will be definitely my next framework to work with.

After mastering CodeIgniter, Laravel will be definitely my next framework to work with. Although CodeIgniter and Zend had the highest number of users, Laravel is growing really fast, for more details you can use google trends search as shown in the image below:


Whatever framework we like or want to use, we need to have a good knowledge in Object Oriented Programming. Although PHP as a server-side scripting language is not considered to be a strongly or a truly object-oriented language like Java or C#, it started to have a great support and functionality for this programming concept since version 5.

Post 17: PHP and ASP.NET

Time is running fast and we have to submit our team projects for both PHP and ASP subjects. This week, we will be concentrating on finishing our features to have two CMS websites at the end. Although the program’s name is Web Development but I think if they rename it to ASP.NET Development should be better as most of our classes focus on ASP more than PHP.

Next semester, we will have the choice to choose our preferred language for creating our projects, and I think we will have the choice to create them individually and not necessary as a team. Anyway, it’s still early to talk about next semester as I have to pass the current one with all the heavy requirements.

This post is very short compared to others, I just like to end it with this great quote by Jim Rohn (an American entrepreneur, author, and motivational speaker). It makes anyone thinks twice before giving up or change his/her goals:

“If you really want to do something, you’ll find a way. If you don’t, you’ll find an excuse.”

Post 16: My Job Experience

In this post, I am going to break the rules, as I am supposed to write about my own experience and progress at Humber College, Web Development Program, as I usually do, but this time I would like to share my success and experience in my job as a computer instructor at COSTI Immigrant Services. So, I would like to change my topic and article for this post only and go back to continue my blog about Humber College next week.

Yesterday was the last day for my fourth cycle of teaching at COSTI, ELT program. Although I usually receive a positive feedback from most of my students, this time I received also a handmade thank you card made by one of the students and signed with nice words from them. It was a surprise and a great pleasure to me at that moment when I received the card with appreciation from everyone.

card1  card2

I am not the best teacher or that smartest person, even English is not my first language, but I do like my job, teach with passion, care about each student in my class, and in spite of that I feel confident about what I teach and how to teach to make everyone active, energetic and involved in the class, including the students who have basic and more advanced skills. Although I am not teaching rocket science and my students’ number don’t exceed 20 or 25 maximum, but I believe that “Whatever you teach, teaching is a talent”, and that’s a very crucial and important thing that employers who are responsible for hiring teachers or instructors should understand and consider. Having a professional and experienced instructor is not enough if that instructor cannot convey their message easily to all the students or make them understand what they teach even if the students are from different levels, background or experience.

As a student, I don’t care if I have a professional developer or programmer such as Bill Gates teaching me (just an example) if he/she can’t deliver or express what they know or choose the right materials for the course. That kind of person could be a very successful developer in one of the most advanced IT companies but a miserable instructor in any school at the same time, yes it’s true. Unprofessional instructor in any field can kill the passion of learning for learners, stop their progress, and reduce their achievements.

Through my experience of teaching, I also received constructive criticism from different students, these criticisms have helped me to improve my personal skills, learn to how to deliver my subjects, and understand how to choose the right curriculums, handouts or textbooks that make the time or the money the student spend really worthy. In my experience in Canada as a computer instructor, I have had some meetings with my managers to discuss some of the students’ feedback to overcome any obstacle standing between me and my students.

Anyway, life is a nonstop learning process and I like to learn from my mistakes as anyone does, building a good rapport with the students by understanding their needs individually, is not an easy task, but the word “Thanks, I learned a lot from your classes” gives me the motivation to keep going and move on with the same enthusiasm.

Post 15: XML Project (Toronto Open Data) and Quality Assurance (Qunit):

I don’t have a lot to say in this post, I am still thinking about finishing my features for each project PHP and ASP.NET. Now we had to make a new project for XML by choosing one of the open course articles that are available as open data (Toronto):
For more information visit open data Wikipedia  and Open Data – Toronto.

For the PHP project, as I mentioned before we need to provide both types of validation: front-end using JavaScript and back-end with PHP and that’s also what the instructor suggested. I gave my reason because the user can disable JavaScript in their browser and that will make our forms vulnerable to any type of input scripts that hack our website or destroy the Database.

In Quality Assurance class, we used JavaScript unit testing framework called QUnit and it was my first time to work on this tool with my team members to validate our forms input using regular expressions. visit quinitjs for more information.

We tried to test our input fields based on different criteria: For the first and last name fields, the input value has to letters only (a-z). For the email and postal code, the input values have to match the regular expression pattern.

Post 14: My learning process, career connections, and quality assurance assignment

The program is getting harder and harder and sometimes I feel bored, sad or too stressed, two years program is shrunk to become 10 months! I am not that satisfied with my achievements this semester especially my midterm compared with the first one, I do believe that this is not me and I can do better. Being a very systematic person with a long experience in teaching different subjects in IT, I can’t easily accept ideas, way of teaching, or curriculums that go beyond the logic or not following the required milestones in a normal sequence, this makes me different from my classmates and I think it is one of my weaknesses that makes me struggling in some subjects every now and then. Through my process of studying, I found myself learning from and using online resources more than the college courses in building and implementing my projects.

I am sorry as this is my first post to talk in this way, anyhow, positivity and determination are the keys to success. Although some of my classmates dropped the program this semester, I chose this path by myself and I have to complete it till the end. I am trying to focus on the present and ignore any negative ideas that might come to my mind. I like this nice Chinese proverb quote that my father told me:

“You cannot prevent the birds of sadness from passing over your head,

But you can prevent them from making nests in your hair.”

In career connection course, each student has to present one company that he likes to work with as a web developer. I was an active job seeker before joining this program and my LinkedIn profile is filled with many companies that I follow and want to work with. Every time I want to prepare my presentation I feel puzzled which one I should choose? Anyway, I just need to make my decision and choose one before the due date.

One of the most weird and interesting assignments that I’ve ever had was for the security and quality assurance course. We had to make limericks based on our subjects: Testing Strategies and Liability. Testing strategy is by making a plan which is formal document evaluating and assessing the results of the testing phases for our project (Web Application). Here is the limerick that I wrote about testing strategies:

Testing Strategies, you have to make

You should provide a real result not fake

Don’t ignore this test, it is a big mistake

You will throw all your efforts in the lake

Hence implement the test properly and be awake

Then, the client will greet you with a firm handshake

Please remember these notes for the goodness’ sake

So work hard on the test then take a nice break

Then I had to write another one for liability,

When clients ask you to add text they wrote

Be careful about what is legal and what is not

The content might be copied, yes it happens a lot

Check their content and examine each spot

Follow the copyright law as this subject is very hot

And protect yourself by wearing the security coat

Not all clients are equal in sort

So make your contract concise and short

Post13: XML, Quality Assurance

In XML class, subjects became more complicated but more useful and important at the same time, after finishing connecting XML with ASP.NET we had to work on XML with PHP this time. We run through many advanced topics in processing XML with PHP using:

• Simple API for XML (SAX)

• Document Object Model (DOM)

• Simple XML

If we need to parse each XML tag from top to bottom of the page, SAX method will be the best approach to apply and it’s faster than using DOM because it doesn’t use memory for storing Data. While using DOM approach, this will run slower than SAX and it will use the memory to save the DOM tree, but since the tree is saved we can access any node using DOM built-in methods.

Using PHP to create XML document was an important subject to discuss and work on in the class, this the technology that is used for RSS (Rich Site Summary); Uses a group of standard news feed formats to publish frequently updated information like news headlines, blog entries.

For the Quality Assurance class, we discussed many test plan that we need to apply in order to test the in and out of our web applications. I learned that there are many types of test to perform on my websites more than the regular or the standard ones:

• Configuration Testing: Software works with different hardware specifications as much as possible.

• Compatibility Testing: Software interacts with other programs or application smoothly and correctly without conflict.

• Foreign Language Testing: Website structure, layout and content has to be localized in the same areas even if the user changes the language.

• Usability Testing: Defining the usability in dealing with a particular interaction, how suitable, operative, or easy for a user to understand that function or piece of software.

That was just a nutshell about what we covered in QA class but still, this course is going deeper into more vital things that we need to consider in building our web applications.

Anyway, I am working on my ASP.NET feature for creating an image slideshow for the home page, and these images files names have to be stored in the database as it’s a database driven website. Using AJAX control in ASP.NET for achieving these tasks is different than using it with JavaScript and jQuery.