How to Install Memcached in Windows 7 / WAMP ?



                 On our last article we have discussed about server side javascript Node.js. Today I am going to explain you how to install Memcache in Windows systemPresently a days, loads of notable sites like Facebook, Twitter, Digg, Youtube are utilizing open source, high performance distributed memory object caching. Which is known as Memcached. Mostly people are comfortable with windows and they are intrigued to create application in windows environment only. So here is an article to tell you the best way to install Memcached into Windows 7 (WAMP). 

             I am using WAMP server 2.1 and PHP version 5.3 in my system. I am going to tell you in step by step process.

   Step 1 :  
                 First of all you need to download memcached-1.2.6-win32-bin.zip. I search a lot and at last got the appropriate package, which you can download from here.
   Step 2 :
                  Then you need to unzip the package and you will get memcached.exe. Now what you need to do is, paste it in your directory. I have paste it in my E:\memcache\memcached.exe. and my wamp server also in E drive.
   Step 3 :
                 Now open the folder and right click on the memcached.exe and run as administrator. As we are utilizing Windows you can easily find out that option when you right click on the memcached.exe.

   Step 4:
                 Now it’s time to install the memcached in server. To do that, Just open your command prompt as administrator settings and type the path of your executable file and space and –d install then hit enter.
For your reference ,

  D:\> your path memcached.exe –d start

For further reference look at the screenshot which I added below,



You may face a error as below screenshot “The program can't install because MSVCR71.dll is missing from your computer .“ 

                            


   Step 5 :
                    In order to solve this issue you have to download the MSVCR71.dll file. I have searched a lot for the right version and finally found it. You can download it from here. Once downloaded the dll file and paste it inside system32 folder (c:\Windows\system32).  Now go to the command prompt where installation is in progress and hit enter. If you are not getting any error meaning that memcached has been installed successfully.


Step 6 :
            Once you have installed memcached in your system, go to control panel. Find out the memcached service and start the service. Otherwise you can open command prompt and type start memcached server. You will get a success message.

Step 7 :
         At long last you need to change setup in php.ini file to make memcached to work with PHP. Then only php will able to recognise memcached server. To do this you need php_memcached.dll. You can download it from here.
           
              That’s all! We are done. Now restart your WAMP server. Your memcached is ready to use and it will boost up the application performance. 

Hope this tutorial is useful. Please do not forget to leave your valuable comments below and share it with your friends. Also let me know if you are facing any issue to follow these instructions. Subscribe to our blog. 

I have also drafted "How to use memcached with PHP?" for my next article. 


   

Which Framework to use Zend or Codeigniter ??


Introduction:


Hello! Performance is always matters a lot for modern applications where millions of users visit your website daily. I personally like to use MVC framework for web application development. It helps me to build faster, structured and modular application. I also believe unless building enterprise level development you don't require large scale fatty framework like Zend, Symfony etc. You may find many questions on the web like "Which is the best PHP Framework ? " etc. My personal opinion is nothing called "best", until you know to code well. Even using good framework you may code worst. In this article I will discuss why many people prefer CodeIgniter over Zend Framework.

I trust programming should be always clean, enjoyable, fun using latest tools, updated features etc. We use Framework to handle all basic task on ease. There are various reason why Codeigniter popular, also has disadvantage over other frameworks too. I will discuss below.

CodeIgniter Vs Zend

The main reason why I love CodeIgniter because of is its performance. CodeIgniter three times faster then the Zend framework. Also CodeIgniter is faster than other popular PHP MVC frameworks. Take a look at these Benchmark test done by Rasmus Lerdorf(creator of PHP programming), here , here. And also take a look at another benchmark test. So it’s clear that CI is faster than other Framework because of tiny library. Rasmus likewise told that he loved CodeIgniter on the grounds that it is quicker, lighter and the least like a structure. 

Another primary purpose for suggestion, it has low expectation to learn and adapt. Downloads come with a tremendous user guide, which is a great documentation like PHP Manual to get started with. I have been using CodeIgniter for last 2 years for web projects as a beginner level, from my personal experience, CodeIgniter has very easy, understandable structure compared to CakePHP or Zend Framework. If you’re a beginner and want to kick start your development structured way with PHP frameworks than I recommend you to go with CodeIgniter for understanding how MVC works. And jump to some other framework when you are comfortable with.

CodeIgniter coding conventions are flexible and simple. Ironically, CakePHP, Zend has very strict coding conventions. So you should be very careful about such cases while coding.

Still question in mind "Why not Zend Framework and why CodeIgniter?" Yes! Zend is PHP company and strong supporter. Ok, So question goes here is "What is so good about Zend Framework ?" Eventually! answer is Zend contains huge set of libraries and classes compared to any other framework. But slow performer. Ok! here another great news is that You can use Zend Framework’s classes in the CodeIgniter using Hooks available in CI. So you can even use any libraries from ZEND as a component in CI. Is it not great! yes.

Conclusion:

Although there are many features may catch your eye to use CodeIgniter but as web development is grown up faster, modern development requires strong object oriented programming for implementing better, robust, modular application. Of course a OOP MVC Framework for the better development, New Framework For Fun, Enjoyable development. In such cases CodeIgniter still lacking. CodeIgniter is still backdated compare to other MVC frameworks in PHP world. Still legacy code into the core where PHP introduced next generation version as PHP7.

Read: 5 Best things you should know about PHP7

Personally, I have learned many things from CodeIgniter as a beginner and towards building easy to use, hugely powerful, Stunningly Fast and enormously efficient modular HMVC Framework as "Cygnite PHP Framework- The New Cool Kid". Version 2.0 is under active development. You may have a look into it for better experience. Some benchmark of v1.3 here, and here

You can use the below comment form to let us know your thoughts and opinion. If you like this article please do not forget to share with your friends. To receive regular updates from us, you can either follow us on Facebook, Twitter, Google+ or you can subscribe to our monthly email newsletter.

Have a good day!

How to populate a select box using jQuery ajax json, php?





Hello Friends! With the help of Ajax and PHP you can easily populate a select box without refreshing the page. You can also do it using only PHP script but requires you to refresh the page every time you change the select box value. Here is a very simple and useful example how you can populate a select box without refreshing page.

Prerequisites

1. Latest version of JQuery.

2. Very basis understanding of JSON.

3. A server side scripting knowledge to respond to Ajax request. In this tutorial I am going to use PHP as a scripting language.

Code:

There are 4 parts in this DEMO.

HTML page

The JQuery & Ajax (Client side code)

JSON structure

Server side code to populate dynamic page.

HTML:


  <select id="category">

      <option value=""> Select Job Type</option>

      <option value="1">Technical </option>

      <option value="2"> QA </option>

  </select>

 <select id="sub-category">

      <option value=""> Select Area Lead</option>

  </select>


JQUERY & AJAX REQUEST:

Include latest version of Jquery in your HTML page. Below ajax script will call server side script to get JSON data and populate select box. Add below script in your page.

 


$(function(){ 
    $('#category').change(function() {
        
        $.ajax({
            type: "POST",
            url: 'https://appsntechinfo.com/demo/list_ajax',
            data: {'categoryID': $(this).val(),'isAjax':true},
            dataType:'json',
            success: function(data) {

               var select = $("#sub-category"), options = '';
               select.empty();

               for(var i=0;i<data.length; i++) {
                 options += "<option value='"+data[i].id+"'>"+ data[i].name +"</option>";              
               }

               select.append(options);
            }
        });
    });
});


And now in your server side page you may write below to fetch data from database.

SERVER SIDE SCRIPT:

We will first validate the category id and fetch data from database then return JSON response to UI.

 

if (isset($_POST['categoryID'])) {

    $id = trim($_POST['categoryID']);
    $result = array();
    $id = mysql_real_escape_string($id);
    $res = mysql_query("SELECT * FROM sub_categories WHERE category_id = $id");
    while ($row = mysql_fetch_array($res)) {

    $result[] = array(
      'id' => $row['subcatid'],
      'name' => $row['description']
    );

    }

    echo json_encode($result);
}

SAMPLE JSON:

 

[
  {"id":10, "name": "Anderson"},
  {"id":11, "name": "Shane"},
  {"id":12, "name": "Shelly"}
]

Follow Us On Facebook Open Source Web Developers by Appsntech facebook group Twitter Open Source Web Developers by Appsntech twitter group Google+ Open Source Web Developers by Appsntech Google group Linkedin Open Source Web Developers by Appsntech, LinkedIn group
Copyright @2011-2015 appsntech.com. All rights reserved.