How to setup domain in your PC

How to setup domain in your PC

In Wamp, you normally place your project files in www folder to run them. In Wamp, you normally place your project files in www folder to run them. But now, you want to organize them in a directory other than www folder, may be in git repository folder. And you also want to access it just like you do using public domain.

This method will help you to do this task.


Following are the steps to setup domain in your pc for development and testing of PHP based application.

1. Open file C:\Windows\System32\drivers\etc\hosts and add this line yourdomain.loc

2. Open file httpd.conf and activate module “vhost_alias_module” if not activated.

3. Decide VHOST FOLDER where you want to save vhost configurations in your drive and add it like this line

IncludeOptional "[VHOST FOLDER]/*"

4. Create vhost config file in VHOST FOLDER and setup following lines

<Directory "[PROJECT FOLDER]">
	Options Indexes FollowSymLinks MultiViews
	AllowOverride all
		Order Deny,Allow
	Allow from all
	Require all granted

<VirtualHost *:80>
	ServerName yourdomain.loc
	ServerAlias yourdomain.loc
	DocumentRoot "[PROJECT FOLDER]"

5. Restart the Wamp Apache only.

6. Now access the domain “http://yourdomain.loc/” in the browser.

7. Enjoy Coding.

Five Reasons – Why we use WordPress

Five Reasons – Why we use WordPress

WordPress is the most famous and powerful content management system in the world. It has strong community, has thousands of plugins and templates. It’s easy to deploy and upgrade. It also get automatically upgraded when new version available.

WordPress admin panel is easy to use and manage. In just a click, you can change the look and feel of your website in WordPress. Need to make your website SEO friendly? No problem, just go to plugins -> Add New and Search “SEO”, you will find many plugins, install the most rated plugin and get your website rank well on Search Engines.

There are many reasons to use WordPress, I am just writing down major five reasons which will be enough to take the decision.

1. WordPress is Open Source

Where, nothing is free in this world, but WordPress is free because it’s open source. You can download the source code and customize according your need. But must read the license documentation about your rights.

Because it’s open source, its community is much stronger and contributed their best expertise to make this application stable and reliable. As WordPress is free, there are thousands of plugins and themes are available as free as well. You can make your website LIVE using any good PHP based hosting in an hour. Now a days, almost every web hosting providers provide click to install WordPress feature in their Hosting Panel.

2. WordPress is for Websites not only Blogs

WordPress was initially developed for blogs but as developers can do anything, so it’s being used for making extensive websites having product catalog, classifieds, social media systems, shopping carts etc.

Now WordPress can be used for making any kind of websites, there is no limit. Either you want to create E-Commerce or just a Blog, WordPress is enough for it alone. You just need to identify the best plugin according your requirements.

3. WordPress Websites are affordable

Do you call it cheap? I don’t. It’s just an affordable as it gives you awesome features with minimum cost without compromising quality, it can never be cheap.

WordPress has thousands of plugins and themes free but for some of your specialized requirements it may cost you but comparatively it’s very little cost.

  • PHP based hosting ($5-$10 per month) will be enough to start.
  • Not everything is free, you may need to buy plugins.
  • If you are unable to find plugin to fulfill your specialized requirements, you may need to hire a PHP developer who is experienced in WordPress Plugin and Theme Development.

Note that, 100% free is always a disaster for your business, so always make budget to buy quality tools.

4. WordPress is Customizable

There are two level of customization.

1. Customization without Programming

Some companies have developed Site Builders for WordPress. If you install them then you can create custom designs by just drag and drop. Go to Google and write “Site Builder for WordPress” you will find many to install. Install only those who have good rating and reviews on WordPress. You can also install any plugin, theme from built-in Theme & Plugin browser in WordPress.

2. Customization with Programming

As you may have some specialized requirements, for which you are unable to find plugins and themes, you can take help of a PHP Developer who is expert in WordPress Development. He will be easily able to implement your specialized requirements in your website by making custom plugins and theme features.

5. Search Engine Optimization (SEO) Plugins

When talk about website, SEO is always important. Because if there are no visitor on your website, it means there was no need to create website. WordPress has many plugins which provide SEO features for easy to create sitemaps, add keywords to your pages, optimize HTML tags for bots to read your website data easily, compress CSS, JS files etc.

Go to Add Plugin section of your WordPress website and write “Best SEO plugin for WordPress”, install the most rated plugin.


For discuss more on this topic, drop me a message in comments. I would love to reply you soon.

Facebook Login Callback Error

Facebook Login Callback Error

I was implementing Facebook Login on my site, and I found this error when Facebook Callbacks to my site with AccessToken.
Error: “Cross-site request forgery validation failed. The “state” param from the URL and session do not match.”

I searched on internet found some solutions like use session_start(), correcting the sequence which nothing worked for me. I checked in Chrome Debugger Network Panel and I found that favicon tag was not assigned and it was calling the same url again so, the facebook url created by the previous request was invalidated and new value for key “FBRLH_state” in session was generated. It was easy to fix the image which I did but as a permenant solution I implemented this flow.

1- Login Page: Create a static url in my site for Facebook Login ( and set to the button “Login with Facebook”.
2- Facebook Login: generate the Facebook Login Url (mentioned in Facebook SDK Documentation) and redirected the request that url.
3- Facebook Callback: The standard way mentioned in Facebook SDK Documentation.
4- Happy Flow 🙂

How to disable srcset in WordPress

How to disable srcset in WordPress

WordPress 4.4 has a new feature which let browsers to select the best image according to the device screen size from a set of images resized by WordPress for different screen sizes. It help to minimise loading time and also bandwidth because if you are using iPhone, it will only load images for iPhone screen instead of big images which are for desktop screens.

As this is the new feature and many plugins are not optimised to use this feature so, plugins may misbehave (i.e. yith-woocommerce-zoom-magnifier on thumbnail selection where it don’t change the image but show the image on mouse hover). So, the quick solution is to disable this feature until new compatible version of plugin is released. You can use following code to do it.

function shiota_disable_srcset( $sources ) {
return false;
add_filter( 'wp_calculate_image_srcset', 'shiota_disable_srcset' );

Ideas are nothing without execution!

Ideas are nothing without execution!

Every person working in some area or even stay at rest has some idea in his mind, some people focus on them and some ignore. The person who focuses on his idea sometime becomes too sensitive about their idea and don’t even discuss with others because it may be stolen and implemented by other. And after all, the idea kept secret without any outcome.

Its important to keep in mind that the idea is nothing without execution. Its not about the idea but the way it is executed which makes a person successful. You may have listened about the Facebook story and also about Windows. From all these, we learned that the strategy of execution is the most worthy thing than the idea itself.

So don’t be sensitive, discuss your idea with others openly and learn the pros and cons before it getting too late for you. May be you will be the next Bill Gates or Mark Zuckerberg.

Stop thinking too much, start from today and discuss with those people who can work with you to make it happen.

You can also discuss with me for a free consultation. I am a top rated developer on UpWork and have 9+ years of software development experience. You can visit my profile at

PHP Serialization vs JSON Encoding for an array

PHP Serialization vs JSON Encoding for an array

When I was working for saving huge array in database, an idea came to mind to look into serialization against JSON. So I searched on internet and found that serialization technique is fast and I also read somewhere that unserialization for huge data is slow as compared to json_decode.

So, I made a program and do an experiment to find out the complexity for space and time of both methods with respect to the data size. Now, I am sharing my results with you. Let see.

My program generates the statistics for serialize/unserialize and JSON encode/decode and also size of serialized and JSON encoded data.

Let see the graphs.

You can see that the json_encode() is very fast as compared to serialize(). But as we know that, encoding will be useless if decoding is slow for a method. So let see the decoding/unserialization graph.

If you look for less data size, you will find that the process is fast for unserialization and for data size larger than 25000, JSON decoding is going to be faster as compared to unserialize. So, it means that if you are working for huge data than use json_decode().

Ooopsss. . . space complexity for serialization method is too high.

If you have small sized data then you can prefer serialization But for large data, serialization will be a worst choice if data is simple and just like an array.

I did this experiment for only arrays. May be results will be different for objects.

Program that I made for this experiment

	ini_set('max_execution_time', 0);
	function start_timer()
		global $time_start;
		return $time_start = microtime(true);
	function end_timer()
		global $time_start;
		$totaltime = microtime(true) - $time_start;
		echo 'Process completed in ' . $totaltime*1000 . ' ms</br>';
		return $totaltime;
	function get_random_string($valid_chars, $length)
		$random_string = "";
		$num_valid_chars = strlen($valid_chars);
		for ($i = 0; $i < $length; $i++){
			$random_pick = mt_rand(1, $num_valid_chars);
			$random_char = $valid_chars[$random_pick-1];
			$random_string .= $random_char;
		return $random_string;
	function save_csv($data)
		$csvstring = implode(array_keys($data[0]),',')."\n";;
		foreach($data as $v)
			$csvstring .= implode($v,',')."\n";
	function runtest($datasize)
		$stats_row = array();
		echo "<u>Making Test Data of size $datasize</u></br>";
		$array = array();
		for($i=0; $i<$datasize; $i++)
			$array[] = array('id'=>$i, 
		$stats_row['datasize'] = $datasize;
		echo '<u>Encoding in Json</u></br>';
		$jsonencodeddata = json_encode($array);
		$stats_row['encode_json'] = end_timer();
		$f = 'tmp/'.$datasize.'_json.dat';
		$stats_row['json_size(MB)'] = filesize($f)/1048576;
		echo '<u>Decoding from Json</u></br>';
		$jsondecodeddata = json_decode($jsonencodeddata);
		$stats_row['decode_json'] = end_timer();
		echo '<u>Serialization of data</u></br>';
		$serializeddata = serialize($array);
		$stats_row['serialize'] = end_timer();
		$f = 'tmp/'.$datasize.'_serialize.dat';
		$stats_row['serialize_size(MB)'] = filesize($f)/1048576;
		echo '<u>Unserialization of data</u></br>';
		$unserializeddata = unserialize($serializeddata);
		$stats_row['unserialize'] = end_timer();
		return $stats_row;
	$stats = array();
	$files = glob('tmp/*'); // get all file names	
	foreach($files as $file){ // iterate files
		unlink($file); // delete file
	for($i=1000; $i<50000; $i+=1000)
		$stats[] = runtest($i);
		echo '<hr>';

If I am wrong at any place then guide me by placing a comment.