Wednesday, April 30, 2008
How to install Drupal 6.2
Installing Drupal is very easy. But if you can't understand how to install it then let me show you. In this tutorial I am using Drupal 6.2 version. Before installation make sure your have all recommended system requirements.
System Requirements are:
- Web Server: Apache or Microsoft IIS
- PHP 5.2 or Higher
- MySQL 4.1 or PostgreSQL 7.4 or Higher
- For other system requirements visit this link: http://drupal.org/requirements
Now follow these steps:
- First of all download latest copy of Drupal from this link: http://drupal.org/download
- Uncompress & put the it into your server's root directory. In my case I put it into /htdocs/ directory and renamed it as 'mydrupal'.
- Now visit it from your browser: http://localhost/mydrupal
- Choose your desire language, I chose: Install Drupal in English
- In this step Drupal will verify your system requirement. If your system requirements are correct then you have nothing to do, just move next.
- Now setup database: go to http://localhost/phpmyadmin & create a database something like 'mydrupal_db'

- Back to Drupal & enter database information. In my case I entered following:
- Database type: mysqli
- Database name: mydrupal_db
- Database username: root
- Database passowrd: [password of my database server]
- Now configure your site:
- Enter site name: 'My Drupal'
- Site email address: 'admin@localhost.com'
- Administrator Username: 'admin'
- Administrator Email: 'admin@localhost.com'
- Administrator Password: '123456'
- Save & Continue
As you are the administrator of your site, do the following tasks to enjoy full control of it:
- Create Administrator Role:

- Go to: Administer > User Management > Roles
- Add Role with a name something like 'Administrator'
- Go to: Administer > User Management > Users
- Here you will find a user with name 'admin'. Now click "Edit" link.
- In the next page check on "Administrator" role & Save
- Assign Administrator Permissions:

- Go to: Administer > User Management > Permissions
- Check on all checkboxes found under 'Administrator' column. This will allow 'admin' user to access all functions of all installed modules.
Congratulations, you have successfully installed Drupal. For more information about how to administer Drupal read this article: http://drupal.org/getting-started/6/admin
If you think this post helps you, then don't forget to Digg it. Thanks a lot!
Posted by
Zakaria Chowdhury
at
11:17 AM
Labels: Beginner Help, Open Source, PHP Support
Saturday, March 15, 2008
PHP Email Attachment Script
I was searching for an easy php email attachment script over net. I found a few scripts but none them able to meet my need. Most of those scripts can send one attachment. But I need to send multiple files. Then I thought to develop a script by myself. To write this function I took help from few examples that I found by searching Google.
I've checked this script with Gmail, Yahoo & Outlook. Hope it will work with other email clients.
Here is the email function which can able to send multiple attachment:function send_email($to, $from, $from_name, $subject, $message, $attachments=false)
{
$headers = "From: ".$from_name."<".$from.">\n";
$headers .= "Reply-To: ".$from_name."<".$from.">\n";
$headers .= "Return-Path: ".$from_name."<".$from.">\n";
$headers .= "Message-ID: <".time()."-".$from.">\n";
$headers .= "X-Mailer: PHP v".phpversion();
$msg_txt="";
$email_txt = $message;
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
$headers .= "\nMIME-Version: 1.0\n" .
"Content-Type: multipart/mixed;\n" .
" boundary=\"{$mime_boundary}\"";
$email_txt .= $msg_txt;
$email_message .= "This is a multi-part message in MIME format.\n\n" .
"--{$mime_boundary}\n" .
"Content-Type:text/html; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$email_txt . "\n\n";
if ($attachments !== false)
{
for($i=0; $i < count($attachments); $i++)
{
if (is_file($attachments[$i]))
{
$fileatt = $attachments[$i];
$fileatt_type = "application/octet-stream";
$start= strrpos($attachments[$i], '/') == -1 ? strrpos($attachments[$i], '//') : strrpos($attachments[$i], '/')+1;
$fileatt_name = substr($attachments[$i], $start, strlen($attachments[$i]));
$file = fopen($fileatt,'rb');
$data = fread($file,filesize($fileatt));
fclose($file);
$data = chunk_split(base64_encode($data));
$email_message .= "--{$mime_boundary}\n" .
"Content-Type: {$fileatt_type};\n" .
" name=\"{$fileatt_name}\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$data . "\n\n";
}
}
}
$email_message .= "--{$mime_boundary}--\n";
return mail($to, $subject, $email_message, $headers);
}
Here is an example to send this script:$to = "test@localhost.com";
$from = "admin@localhost.com";
$from_name = "Administrator";
$subject = "This is a test email";
$message = "Here is my message...Text or <b>HTML</b>.";
$attachments = array();
$attachments[]="C:/Program Files/xampp/htdocs/images/my_image.jpg"; // absolute file path here
$attachments[]="C:/Program Files/xampp/htdocs/images/my_music.mp3";
send_email($to, $from, $from_name, $subject, $message, $attachments);
Let me know your thoughts and also if you face any problem.
Posted by
Zakaria Chowdhury
at
11:31 AM
Labels: PHP Support
Tuesday, February 5, 2008
GraPHPite - Open Source PHP Graph
Creating graph in PHP is not so easy. You need to know lots of things, specially image manipulation by php. But there is a very easy solution for creating graph in PHP. It is GraPHPite. It is a free and open source graph rendering utility. Just download this script, place into your web directory and create your graph with the help of tutorial & documentation. You can create several types of graphs with it. You can create layouts with legends, fill using image or can create gradient smooth area. Another important feature of it is you can create multiple plot into a single graph. Types of graphs it can generates are:
- Line Graph
- Area Graph
- Bar Graph
- Stacked Bar Graph
- Stacked Area Graph
- Pie Graph
- Radar Chart
- Vector Function Graph
- Step Chart
- Impulse Chart
- Dot Chart
- Map Chart
- Logarithmic axis & more...
PHP4 or PHP5 with GD 2 support for optimal performance. I think this is very common to most of the servers.
Download
Download the latest version 1.2 from sourceforge.
Documentation
Full documentation is available from the site. Click here to view it.
Samples & Tutorials
Here are few excellent samples available in this link. You will find few good tutorial from here.
I think this graph utility will meet your all kind of needs for creating graph in php. You will also find that, creating graph with it is also a kind of fun. Hope you will like it.
Posted by
Zakaria Chowdhury
at
9:30 PM
Labels: PHP Support