RSS

Category Archives: Web Development

How to Send Mail From Localhost-PHP


If  you are using wamp in a windows machine,its quite hard to send mail through native php mail function or sendmail or SMTP.But you can use PHP Mailer program to send mail from localhost.It bypasses native mail,sendmail methods.It works well on windows as well as *nix machines.

Download PHP Mailer from http://sourceforge.net/projects/phpmailer/files/phpmailer%20for%20php5_6/ or from http://phpmailer.worxware.com/

Sample code

<?php
require($_SERVER['DOCUMENT_ROOT'].'/phpmailer/class.phpmailer.php');
require($_SERVER['DOCUMENT_ROOT'].'./phpmailer/class.smtp.php');
$mail  = new PHPMailer();
$body="<b>This mail is sent using PHP Mailer</b>";#HTML tags can be included
$mail->IsSMTP();
$mail->SMTPAuth  = true;                 #enable SMTP authentication
$mail->SMTPSecure = "ssl";               #sets the prefix to the server
$mail->Host  = "smtp.gmail.com";         #sets GMAIL as the SMTP server
$mail->Port       = 465;                 #set the SMTP port
$mail->Username   = "";                  #your gmail username
$mail->Password   = "";                  #Your gmail password
$mail->From       = "";                  #your gmail id
$mail->FromName   = "";                  #your name
$mail->Subject    = "Subject of the mail";
$mail->WordWrap   = 50;
$mail->AddAddress("recipient mail id","recipient name");
$mail->IsHTML(true); // send as HTML
if(!$mail->Send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
echo "Message has been sent";
}

?>

You can also send mail with attachments.For more info refer the documentation of PHP Mailer.

Caution:

Change SMTP Host,port,authentication only if sure of what you are doing.

 
3 Comments

Posted by on October 8, 2010 in PHP, Web Development

 

Tags: , , , , , , , , , , , ,

How To Create an Alias in Wamp


When you install wamp, www will be the default folder to put your site and it will be accessed by http://localhost/site-name.But how can one run site that exists outside www folder.Here ‘s the simple solution

Create a folder in any one of your parititons.Here i have created a folder called trunk in C:\ drive.

  • Right click the wamp icon click and go Apache->Alias directories->add an alias

Wamp-Create-Alias

A new command window will be opened

  • Enter the only(without ant relative or absolute path) the name of the folder that you created and hit enter.

Example:trunk

  • Now specify the path where the folder is located and hit enter.

Example: c:/trunk/

Thats it alias created.Site can be accessed with this url http://localhost/trunk.Store all the files in the folder that you created.

 
1 Comment

Posted by on October 7, 2010 in PHP, Tips & Tricks, Web Development

 

Tags: , , , , ,

Why Zen cart?


Its good to be back in action after 2 months of break.This article is going to talk about Zen cart, one of the best eCommerce software available in the market.This is not a comparison between popular eCommerce softwares but solely talks about Zen cart.

Why Zen cart?What it offers for those who want to start a eCommerce store?


Answer is, it offers huge amount of features.No eCommerce software  in the world satisfies all the needs  of a store owner.Zen cart is really close to achieve it.Zen cart is a opensource, community driven software.So the software is free to download and use.Zen cart is targeted at those who are not technocrats in the sense that it can be used by people who don’t have programming experience.http://www.zen-cart.com

Pros of Zen  cart!

Its main features are unlimited category depth, multiple shipping,multiple payment options and greater control over store layout.Admin Section  look & feel  is as good as store.For an example the product management allows us to create products in just couple of clicks.

Zen cart got a very strong community support,so one can get in short time for there problems.Most of the problems that we encounter are no need to be posted,go and search the forum people would have already posted solutions. Its WIKI and FAQ are more than useful to start.There are hundreds of free templates available to use.Also we can change templates in just one click.

Cons of Zen cart!

The default checkout procedure of Zen cart is really frustrating.It asks date of birth password,etc..,which are quite irrelevant   during the purchase of products.

It’s default SEO also is not up-to the mark.It displays product ID in url which wont help in site indexing.

The worst thing in Zen cart is it overwrites the image,if the image already exists in images folder without throwing any warning message.

For all those problems mentioned above,modules can be installed to get rid of it.

The default look & feel of Zen cart template is not pleasing for buyers.However we can change the look &feel easily.

Insight View:

Zen cart is programmed in PHP with MySQL.Its also fork of osCommerce.Functionality wise it is better than osCommerce.No third party libraries is used in the code.Code hacking is very easy.Also Zen cart follows a template structure without using any third party template engines like smarty.

Zen cart developer’s guide

http://www.zen-cart.com/docs/phpdoc-1-3-9b/

http://www.zen-cart.com/wiki/index.php/Developers

CSS web developers who don’t know programming no need to worry about editing the layout. Style sheet separated from functionality.So changes in style sheet wont affect functionality.

So the final word  is Zen cart is truly the art of eCommerce.

 
Leave a comment

Posted by on August 5, 2010 in Web Development

 

Tags: , , , ,

freewebhostingarea: Best Free web Host


freewebhostingarea is one of the best free web hosts that i have came across.It offers features like ftp,one click auto installer for moodle,joomla, word press,phpBB,drupal php5, MySQL, cpanel  and servers run on linux.Registration is free.It offers 500MB of webspace and based on the traffic level they increase the size of web space.Only limitation is they offer only sub domain for free users.Most important thing is one can have more than one account and they wont display their ads in our site.

For more Details visit:

http://www.freewebhostingarea.com/

I’ll move this blog to freewebhostingarea in near future.

 
Leave a comment

Posted by on April 9, 2010 in Networking, Web Development

 

Tags: , , , ,

10 Ways to Improve Website Uptime


Jason Mayes, senior Web development engineer at XMOS Ltd., offers his own top 10 list for dealing with site congestion and other potential server outage problems:
  • Optimize your static content. Compress images to get every last kilobyte out of them while retaining visual quality.
  • Use Minify (a PHP5 app) for your CSS and JavaScript to compress Web data, and put JavaScript at the end of the document where possible.
  • Add “expires” headers to content to prevent browsers from continually downloading the same files as a user browses your Web site.
  • Ensure that your Web server delivers content in a compressed state — for example, mod_deflate for Apache. Clearly this should not be applied to files such as images — which are already compressed — so make sure you set up rules correctly.
  • Make fewer HTTP requests to fetch your Web site. Combine CSSs into one file. Combine JavaScripts into one file where possible
  • Include these files only on the pages where they are required.
  • Optimize your content management system. Reduce the number of database calls you need to make for each page request, for example. In Drupal, this can be as simple as disabling modules you do not need. Also, make any custom code more efficient if possible. A change of one-tenth of a second in an algorithm that is run thousands of times adds up.
  • Support caching of data that is frequently accessed. Use Memcache or something similar. Many CMS packages support this, but be careful with dynamic data.
  • Load-balance your Web server.
  • Separate your read/write databases so that you can have a master/slave database setup, allowing your database infrastructure to be scalable.
  • If applicable, split your database vertically or horizontally (or potentially a hybrid of these if this model suits your database structure) over several servers. This may not be suitable for everyone, however.
 
Leave a comment

Posted by on March 26, 2010 in Web Development

 

Tags: , , , ,