Making mail() function of PHP work under windows os

mail() is a useful function in PHP for sending mails, but many developers face problems in making mail() work properly on Windows.


In the section [mail function] in the php.ini file, you’ll find three settings:
SMTP, sendmail_from, and sendmail_path.


If your server runs on a Windows machine, you’ll have to set the SMTP option to point to your SMTP server for sending mail using PHP.


So, we must understand that PHP must have the address of some SMTP server where it would deliver the mail to be sent and that is all PHP can actually do.


So, we need  to set SMTP to the SMTP server and the sendmail_from option to the required email address.
Now if we want to use localhost as the SMTP server, we must have some SMTP server running on our system, simple isn’t it?  So we can download and install hMailServer from www.hmailserver.com/ for serving our purpose.


After installing the mail server make sure that you switch off  SMTP authentication for connections coming from localhost / 127.0.0.1 in hMailServer for your mail() function to work.


And this is how [mail function] part of your php.ini should look:


[mail function]
; Setup for Windows systems
SMTP = localhost
sendmail_from = me@mydomain.tld

Apache2 php5 & mysql installation through ssh (on apt supported systems)

I have seen lots of forum where newbies face problem while installing lamp server. So, what they can do is directly file the following line of code and everything will be done automatically:

sudo apt-get install apache2 apache2-mpm-prefork apache2-utils apache2.2-common libapache2-mod-php5 libapr1 libaprutil1 libdbd-mysql-perl libdbi-perl libmysqlclient15off
libnet-daemon-perl libplrpc-perl libpq5 mysql-client-5.0 mysql-common mysql-server mysql-server-5.0 php5-common php5-mysql

Another alternative that can be done is:
File the following commands in sequence:
1: sudo apt-get update
2: sudo apt-get install lamp-server^