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
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^
With the ever dynamic web world and to turn the web from a passive to an active entity , webmasters are fascinated with the idea of having subdomains for users like http://user.domain.ext. Looks quite neat and tricky.
Yes that can be done easily, just by some configurations in your website cPanel. The steps are:
A. Login to cPanel
2. Then go to subdomains(… Dont worry u need not add subdomains for all of them individually
)
3. Now just create a subdomain with name * that is: *.yourDomain.ext and specify a root directory for it.
4. That is all.. Its done..
Now how to get the subdomain.. right?
1. Create a file called index.php in the *.yourDomain.ext root.
2. Add the following lines in the file:
<?php
$exp = explode(”.”, $_SERVER['HTTP_HOST']) ;
$username = $exp[0];
echo “Subdomain called: “. $username;
?>
Now just call any arbitary subdomain.. and see what happens