Tag: php

Understanding Laravel Framework

laravelBased on developers survey, Laravel is listed as the most popular PHP framework , designed for the development of model–view–controller (MVC) web applications. Best and fast growing PHP framework.

Which has lot of functionalities, best framework for low and high end application development.

The current version of laravel is 4.2.11 ( October 4, 2014).

It has composer functionality, which means we can run lot of functions through command prompt mode. So here i gonna list some of laravel composer commands for best understand when use composer.

create project :
–> composer create-project laravel/laravel your-project-name –prefer-dist Continue reading “Understanding Laravel Framework”


PHP Get Current URL Full Path

In PHP Get Current URL, I have explained how get current page URL with parameters in PHP. To Get Current URL of the Page, we can use $_SERVER environment variables.

Below is the list of useful environment variables for getting current Page URL.

$_SERVER[‘HTTP_HOST’] => Host name from the current request.
$_SERVER[‘HTTP’] => Set to a non-empty value if the protocol is HTTP
$_SERVER[‘HTTPS’] => Set to a non-empty value if the protocol is HTTPS
$_SERVER[“SERVER_PORT”] => Server port. Default is: 80
$_SERVER[‘REQUEST_URI’] => The URI to access this page;
For example, ‘/index.php’.

1). We can get protocol schema

$schema = (@$_SERVER[“HTTPS”] == “on”) ? “https://” : “http://”;

2). If the server is running on standard port(80,443), full URL path becomes:

//EX: http://www.hayageek.com/test.php

3). If the server is running on non standard port, full URL Becomes


//EX: http://www.hayageek.com:8080/test.php
Note: In PHP, We can not read URL path after hash(#) tag. Because browser does not send the hash data to server. You can get #tag data only with JavaScript.

Combing all, below is the function for getting current web page URL in PHP

function getCurrentURL()
$currentURL = (@$_SERVER[“HTTPS”] == “on”) ? “https://” : “http://”;
$currentURL .= $_SERVER[“SERVER_NAME”];

if($_SERVER[“SERVER_PORT”] != “80” && $_SERVER[“SERVER_PORT”] != “443”)
$currentURL .= “:”.$_SERVER[“SERVER_PORT”];

$currentURL .= $_SERVER[“REQUEST_URI”];
return $currentURL;

echo getCurrentURL();

Source Help – http://hayageek.com

How to send emails from localhost in Xampp / Wamp / Lamp (PHP)

Hi friendz,

PHP mail function is very important one in project development. When we go to use and test this mail(), it would be working great in web servers but in localhost we may face more problems, ok we will test, how to solve this,

here we go,

First in your appache installation folder, check your php folder and inside open php.ini file.

search for a word (sendmail_path) and then you can see like below line code,

;sendmail_path = “\”E:\xampp\sendmail\sendmail.exe\” -t”

make a uncomment that file like below

sendmail_path = “\”E:\xampp\sendmail\sendmail.exe\” -t”

and you can see one more file


dont uncomment the above one, let it be same like this

and then go to sendmail folder in your xampp path and open that folder
inside open that sendmail.ini file

here we use Gmail email configuration for our setup.

in smtp_server set up make it like below


and smtp_port make it like below


and finally one more thing

auth_username=your gmail username
auth_password=your gmail password

that is it guys. restart your apache and mysql, then it will be working sweetly.

Hope you guys get it easily.




Setting Up Apache Server Virtual Host In Your Windows OS

imagesFor Coders, This Virtual Host option is flexible in project making. There is lot of 3rd party tools available in the market like Xampp, Wamp, but those are set to be in proper directories or else it wont work.

If you are a php developer and need to organized your website projects on certain folder with each individual host address e.g. “test1.web”, “test2.web”, you can use any name for virtual host but don’t use “.com” extension as this will tell the browser to look the website on the internet and not on your local pc.

This procedure assume that you have already installed the apache for windows, php module for apache

Step -1 :-

open the apache configuration file, note that better to install the apache on the root of drive C:

(c:/apache/) to make it compatible for short naming folder, ok so assume your apache was installed on the root drive c:

so open the configuration file on c:/apache/conf/httpd.conf and enable the virtual host module, scroll down to near end of configuration and you will find this

# Virtual hosts
# Include conf/extra/httpd-vhosts.conf

uncomment the vhost module by removing the hash character on fron of it so it will look like this

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

ok save the file. Continue reading “Setting Up Apache Server Virtual Host In Your Windows OS”