FCI-Helwan blog

Just another FCI-H weblog

Installing Drupal with PHP 5.2, Apache2.2 and MySql 5.0

Drupal is an open source Content management system (CMS) which can create rich content light weight web sites, you can visit www.drupal.org for information about drupal.
This post targets the setup process of drupal on a Windows environment. Linux version of this post will be available soon.

Drupal is based on PHP,simply, it is a framework built using php, so in order to get it working you need to setup the environment suitable for PHP to work.

A- You need:
1- A web server (Apache is recommended for drupal however IIS is supported)
2- PHP itself
3- A data base server (Drupal supports both MYSQL 4.1+ and PostgreSql 7.3+)

1- Apache:
# you can get latest version of apache (2.2) from Here
— Setup:
Apache is very light weight web server with very easy to install procedures.
2- PHP:
# you can download PHP 5.2.3 HERE
— Setup:
It is recommended to download the Zip package and extract it manually to a folder usually C:\PHP

3- MySql:
# Mysql is a very efficient,light weight and easy to use data base server, currently the lastest version is 5.0 and u can find it HERE also you will find a set of usefull tools for mysql such as GUI admin which is very good instead of mysql command line.

B- Setting up PHP to work with Apache:
you need to configure apache to identify .PHP files and to process them upon request, this can be done by:
1- open the directory named Conf in the installation directory of Apache
2- edit the text file named httpd and:
– look for DirectoryIndex and add index.php so it looks like this:
DirectoryIndex index.html index.html.var index.php

– look for Addtype Section and add after the last sentence these lines
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps

3- Now you need to load the php module for the apache to deal with, add these lines to the httpd file after the last LoadModule line:
LoadModule php5_module "C:/php/php5apache2_2.dll"
PHPIniDir "C:/php"
# of course directories here are relative.

What wont work:
1- Opening a .php file directly by left clicking it.
for apache to deal with a php file it has to be located in htdocs folder located in the apache installation directory and you can call a .php file by writing this in the address field of your web browser: http://localhost/"filename".php

C- Back to Drupal:
for druapl to start working you have to copy the folder named drupal-5.1 downloaded from drupal web site to the htdocs folder of apache, and type this in your web browser:
a page may appear with the message saying that your web server does provide any data base supported by drupal. How can this happen? we already installed Mysql!!!
The answer is in PHP itself, at this point you may get confused about the reason of that error and you start going in circles and reinstalling apache and PHP as well as mysql, this is not the error…
the problem is simply that mysql module is not installed in php

D- Installing Mysql to work with PHP
1- make sure that u have the Dll files requried for mysql in the ext folder (php_mysql.dll)
2- make sure that php.ini file is present in the PHP folder, AND NOT PHP.INI.RECOMMENDED, rename this to php.ini.
3- php.ini and look for
extension_dir = “.\” and change it to
extension_dir = “.\ext”
4- look for the line extension=php_mysql.dll in the dynamic extensions sections and uncomment it by removing the ‘;’ on its left.

As a basic test, many sites recommend writing a simple php script file the returns php info on your machine and running it to make sure that everything is fine, however, on some machines – including mine- after setting up the mysql module, this simple script does not work. To test, just point to this in your browser http://localhost/drupal-5.1
it is supposed now that you will see a database configuration page with the drupal logo above, this indicates that we are approaching the last step.

E- Drupal into action:
drupal needs a database with full access permissions to manipulate many aspects for building and managing sites, so we need to create a database in Mysql dedicated to Drupal, this can be done by writing some commands to the command line:
1- create a database in mysql for example named “drupaldb”

  mysqladmin -u username -p create drupaldb
2- manage ur database

mysql -u username -p

3- Setting the permissions to the user u created and logged in with to mysql, as this user
name will be supplied to drupal to work with it


TEMPORARY TABLES, LOCK TABLES ON drupaldb.* TO ‘username@localhost’ IDENTIFIED BY ‘password’;

where user name is the drupal user name and password is this user’s password.

now, supply the required information to the database configuration page of drupal, and hopefully every thing works now :).


August 18, 2007 Posted by | Database, Drupal, open source | 5 Comments

Get your Video Series: SQL Server 2005 Express Edition for Beginners CD

We would like to announce about we have downloaded “Video Series: SQL Server 2005 Express Edition for Beginners
So, for whom they like to take it, kindly, drop a comment! just to know the number of people, 3rd year students have higher priority as they study Microsoft SQL Server 2000
So, volunteers who will burn more CDs kindly, drop a comment!
Actually there are 5 CDs for anyone and 5 CDs for volunteers (who should copy at least one CD for other people)

February 14, 2007 Posted by | Announcements, Database, MSSQL | 4 Comments

Video Series: SQL Server 2005 Express Edition for Beginners

Getting Started with SQL Server Express

This video series is designed specifically for SQL Server beginners—individuals who are interested in learning the basics of how to create, manage, and connect to SQL Server Express databases. Whether you’re just a beginner or somewhat familiar with databases, these video lessons will help you get better acquainted with SQL Server 2005 Express.

Getting Started

The series includes almost 9 hours of video-based instruction that walks SQL Server beginners through the steps of learning about SQL Server databases to actually connecting a SQL Server database to a Web application. Select your starting point below based on your skill set.
Learning Video 1: What is a database?
Designing Tables
Learning Video 2: Understanding Database Tables and Records
Learning Video 3: More about Column Data Types and Other Properties
Learning Video 4: Designing Relational Database Tables
Database Functions
Learning Video 5: Manipulating Database Data
Learning Video 6: More Structured Query Language
Learning Video 12: Creating and Using Stored Procedures
Learning Video 13: Enabling Full-Text Search in your Text Data
Creating and Using Reports
Learning Video 10: Getting Started with Reporting Services
Learning Video 11: Embedding, Packaging and Deploying SQL Server Express Reporting Services
Database Security
Learning Video 7: Understanding Security and Network Connectivity
Database Management
Learning Video 9: Using SQL Server Management Studio Express
Publishing to the Web
Learning Video 8: Connecting your Web Application to SQL Server 2005 Express Edition

For more information, here

February 13, 2007 Posted by | Database, MSSQL | Leave a comment

Data Normalization

After gathering required information from end-users who are going to use your application, you move to design database and you should spend sometime to design it well because any mistake in your design would cost you a lot of effort, money and time if your application built on it…

Data Normalization is the process of organizing information in your database to should be able to develop professional code to update and retrieve data efficiently and your code comes from a series of rules of standards called NORMAL FORMS

Let’s execute that code [SELECT * FROM student] so the output is

It’s definitely wrong as what about if I want to sort by Student’s Last Name I have no way except writing functions to do this job and that’s wrong

After modification solution is:
Let’s execute that code [SELECT * FROM student] so the output is

So now it’s very easy to make all operations I need to sort by any attribute and update and retrieve needed data

Let’s execute that code [SELECT * FROM student] so the output is

Unquestionably very wrong to do that for many reasons first of them I can not count all students who take Microsoft SQL Server 2005 course second what about if a student intend to take another course you need to modify the schema or the design of the relation and never ever put yourself in a case according to it you may change your database schema, believe me if you did, you would be fired, assume well to design well…

After modification solution is:

Now I can count all students who take any specific course and also update data smoothly without any modification in database schema

So we can summarize FIRST NORMAL FORM as:

1- Each attribute in a relation should contain only one piece of information that you can care about.
2- And also each piece of in formation that you can care about should be contained in just ONE attribute.

It focuses on relation itself and its concepts are:

1- Database must be in FIRST NORMAL FORM.
2- Every attribute should be functionally dependant on the entire primary key.
3- Every relation should model just one entity, object or event.

Let’s execute that code [SELECT * FROM student] so the output is

According to SECOND NORMAL FORM concept we see that relation violate SECOND
NORMAL FORM as CourseName dependant on to primary keys they are StudentID and

After modification solution is to have two tables one for
StudentCourse and one for Course respectively as shown

Here, we divided first table to two tables to avoid violation of SECOND NORMAL FORM as in last table CourseName became just dependant on CourseID.

Let us show what the concepts of the THIRD NORMAL FORM

1- Database must be in SECOND NORMAL FORM.
2- The attributes in addition to be dependant on entire primary key it should not be dependant on another attributes.

3- Don’t store any calculated or derived values, only store the raw data and use queries to perform calculations and looks up as needed.

Let’s execute that code [SELECT * FROM Item] so the output is

Here, all attributes dependant on ItemID as it’s the primary key of this table however the problem is in TotalCost as you see TotalCost is a calculated value result FROM multiplication of ItemCost by ItemQuantity and that’s a violation of THIRD NORMAL FORM.

As we saw applying normalization to our design is very easy and logical but also not applying it will cost us a lot and a lot, and while designing large database you will find some difficulty to achieve the equation that you must attain performance, normalization, efficiency, all end-users requirements and so forth so they are cases you should DENORMALIZE your design i.e. what about if end-user asked you to store calculated or derived values in this case if you didn’t find solution you would be forced to say “Ok”.

In the article I just mentioned 3 forms of NORMALIZATION and there are other forms like Boyce-Codd normal form – BCNF, Forth normal form – 4NF and fifth normal form – 5NF, may next article will mention them in details

February 12, 2007 Posted by | Database | Leave a comment