Installing MongoDB driver for PHP on Windows

 

mongoPHP-logo

MongoClient class is included in “Mongo” that is official MongoDB driver for PHP. MongoClient class is required to connect MongoDB and required by several packages that bridge between MongoDB and PHP. Here is detail of this driver on php.net:  http://php.net/manual/en/mongo.manual.php

Mongo works on almost all of Operating Systems including Windows, Mac OS X, Unix, and Linux; little- and big-endian machines. No matter 32 or 64-bit machines. PHP 5.3 through 5.6. To install it, there is a “mongo” package on PECL.

To install Mongo for Windows, you need to do following steps (Tested with Windows 7) :

  1. Download this package from PECL website manually. Go to PECL Mongo package and choose latest stable version’s DLL by clicking on DLL link.
  2. Choose Thread safe x86 version, even for 64 bit system and download it. 64-bit version didn’t work for some people while x86 on 64-bit system worked fine so use download x86 thread safe version.
  3. Extract the zip file that is just downloaded, and place it in your PHP’s ext (extensions) directory. Ext directory can be find through phpinfo().
  4. Once placed in PHP’s ext directory, open your php.ini file and add follwing line and save it:
    extension=php_mongo.dll
  5. Then restart your apache server and test your code which use MongoClient class. It should work now.

In case of any problem, feel free to ask in comments.

Technical checklist: How to start coding new project

Even a fresh graduate out of university or a college student can do programming. They can create websites, mobile applications, and much more stuff. But inexperience person with quick start of a project without considering important aspects can result in a lot of problems. In fact, seasoned programmers who don’t consider important factors before starting project end up with similar problems. Remember, experience is although listed in number of years, but maturity, quality and efficiency  don’t come only by understanding and fixing problems but also not doing same mistakes again and again. Maturity come by learning from own and others mistakes.

So whether you are a seasoned programmer or a new programmer, here is a check list having some important things to consider before starting your next project. Here I am more focusing on programming related stuff not project management side.

Understand the big pictures:

Even though we are not focusing on project management size but at any level understanding the big picture is very much important. Even if your work is a small part of something big, still you should at-least understand how your work is going to interact with and will be integrated with rest of system. This will let  you avoid many small mistakes which can later appear as big problems. Also based on big picture you can better decide about technology and approach for your work.

Some documents are helpful:

Yeah I know lot of documentation sometime overshadow actual development process. I am not asking for that. But you should at-least have some sort of  diagrams which clearly state important flows, rules and relations. If that is not possible then should have a bullet point document so that your client can understand what you are going to do before seeing something actually coded and working in-front of him and believe me it will be really helpful for you to develop something that is decided and listed instead of developing while thinking about missing pieces.

Have  a DB diagram:

If you are using a database in your project then you should at-least have an initial DB diagram ahead of coding business logic to keep you on track. Try to create a DB diagram even if you have decided to not making any other diagram.

Write and run Test Cases:

I understand that most of programmers don’t have time for writing test cases. It consume time to write more code for testing your code. But there are already such testing frameworks which can make your work a lot easier. It will still take time to write tests but it will really rescue you in case of any major change requested by client or due to some mistake . In the middle of project, developers hesitate to change existing functionality because that can break some parts of system that no body will know before shipping code that can break while in production.

But sometime it is crucial to do such major changes so here automated testing tools can rescue you. These test cases let programmer know that where change is effecting. So that programmer can fix those places before shipping and rerun all test cases. It provides much more confidence to developer over his code.  It is up to you  that which type of testing you want to use and which framework you want to use for that.

In fact, in my last project client 2 times asked for such major changes and we already had test cases written, so after doing changes I just ran test cases and it showed me the test cases failures. So I fixed those parts accordingly. So after doing all changes and fixing everything I again ran test cases and at the end I was confident that now there wasn’t any remaining broken thing due to that major change.

If still not convinced that Automated Testing can make your life better, then see a this question answer format article: Why to write test cases using Automated Testing tools?

Use Latest Stable version:

Always use latest stable version of a framework or library if possible. Because the product or project you are developing right now will be in production after some time and then it will remain in production for much more time. So use latest stable version available so that you or product owner don’t need to upgrade libraries or frameworks again and again and can utilize latest features from day one.

Version Control is always important:

Version control tools are not only useful for keeping versions and history but it can be useful as a tool for auto merging different team-mates’ work too. Other than that, it is very helpful for having an on-line backup other than on your system so one can access it from anywhere as well as it is safer to not rely on single system.

Use Dependency Injection:

If your framework or library provide a way of dependency injection then use that or get dependencies available for your class in class’ constructor instead of separately instantiating objects in different methods of a class. Because this way you will not only know your class dependencies easily but you can also replace them easily if you want.

Use Interfaces:

Try to always use interfaces instead of concrete classes for instantiating objects. Interfaces make your code loosely coupled and let you swap parts of system much more easily.

Use thinner Controller:

If you are using MVC pattern then your controller must only have, required things and should be thinner. And reusable stuff should never be in controller but in library, helper or model etc.

Respect SOLID:

As per wikipedia, SOLID (Single responsibility, Open-closed, Liskov substitution, Interface segregation and Dependency inversion) is a mnemonic acronym introduced by Michael Feathers for the “first five principles” named by Robert C. Martin in the early 2000s that stands for five basic principles of object-oriented programming and design. Here you can find more information about SOLID. https://en.wikipedia.org/wiki/SOLID_(object-oriented_design)

However what I want to say is that SOLID will make your programming and work better. And your code will be much more flexible and clean.

So these are few things which are in my checklist, let me know if there is something else that you think that it should be added in this list. I will try to later attach detailed articles to most of these points which need more clarification or detail.

Thanks.

API Testing: Installing and Using Codeception

In this post, we will have a look on how we can use Codeception for API testing. First we need to install codeception.

Installation:

Here is Codeception’s quick start guide that show multiple ways to install codeception. Here we will be installing through Composer, you can follow any other method as you like.

First go to directory where you want to install Codeception and place your tests. In my case that directory name is “app1”.

composer require "codeception/codeception:*"

or

php composer.phar require "codeception/codeception:*"

It will take some time, and fetch codeception. Once it is done, you will be able to use codeception command line tool. Try running codeception following command to make sure that you have codeception installed.

vendor/bin/codecept --version

Setup Codeception:

Here is something you need to do to setup your codeception testing environment. Run following command from root of your app directory.

vendor/bin/codecept bootstrap

It will create ‘tests’ folder at root of your app directory. This is where all your tests files and information will live. This tests directory will have many directories including acceptance, functional and unit . These directories are related to different types of tests suites.  We need to have api test suite, that isn’t yet created here. So let’s create that now.

vendor/bin/codecept generate:suite api

ok now in tests directory it will have a new directory named “
api
” . That will have Api Test suites in it. Ok, before moving further, let’s first get rid of this long path “vendor/bin/codecept” so that we can just use “codecept” command instead of whole path.

So if you are on linux, ubuntu you would probably be interesting in installing codeception globally. So that you can simply use “codecept” command from anywhere. Here is how you can do this: http://stdout.in/en/post/install_codeception_globally_in_ubuntu

If you are on windows then you can simply add it in your system path.

Ok once done that you can now to use codecept command you can simply say “codecept” and it will work.  Simply try following command from anywhere.

codecept --version

Now you are ready for next things but let’s first understand directory structure of codeception.

Codeception Directory structure:

If you go in “tests” directory which is created as a result of “codecept bootstrap” command. There you will see following directory structure.

  • _data
    This directory can have DB file if you need to use that.
  • _output
    This directory contains output of tests in case of failure.
  • _support
    This directory can have helpers if you write that to support your tests.
  • acceptance
    This directory is useful if you need to write acceptance tests.
  • api
    This directory is useful if you are writing api tests. This directory is not present by default but it will be created as result of api suite generation command.
  • functional
    This directory is useful if you need to write functional tests.
  • unit
    This directory is useful if you need to write unit tests.
  • _bootstrap.php
    This file is useful for autoloading any file that you want to include.
  • acceptance.suite.yml
    This file contain configuration of acceptance suite.
  • api.suite.yml
    This file contain configuration of api suite.
  • functional.suite.yml
    This file contain configuration of functional suite.
  • unit.suite.yml
    This file contain configuration of unit suite.

Also in api directory there is _bootstrap.php . It is useful if you want to include and autoload any file inside api suite only.

API test suite configuration:

Open api.suite.yml and add PhpBrowser helper and add URL, it should look like something like this:

class_name: ApiTester
modules:
    enabled: [ApiHelper,PhpBrowser, REST]
    config:
        PhpBrowser:
            url: http://localhost/app

Note: Above code snipper for yml file contains 4 spaces per tab and not tab character.

Laravel or PhpBrowser module :

If you are using Laravel, then you can add Laravel module instead of PhpBrowser. So that in case of error, if you are using Laravel module then error message will be more debug-able than a 500 error that can be seen on browser screen too. I was previously using Laravel module and error was more clear with better insights but problem is that Laravel module is much slower than PhpBrowser module so I switched to PhpBrowser. However if you have good RAM and not yet concerned about speed of execution of your test cases, specially if they are less than 50, then using Laravel module is better option. So it all depends on you.

Writing Test Case:

There are two ways to write test cases based on two types of files. Cept and Cest. Cept is a scenario-based format and Cest is a class based format. Actually it depends on how you are comfortable writing code for test cases. In strucute way or using classes. I prefer and recommended class based format because it will give you OOP power for writing more test cases with less code in long run.

So generate your first Cest file by this command:

codecept generate:cest api CreateUser

Now open that file and put some code in that as below.

wantTo('create a user via API');
        $I->amHttpAuthenticated('service_user', '123456');
        $I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded');
        $I->sendPOST('users', ['name' => 'davert', 'email' => 'davert@codeception.com']);
        $I->seeResponseCodeIs(200);
        $I->seeResponseIsJson();
        $I->;seeResponseContains('{"result":"ok"}');
    }

}

Here $I contains the object of ApiTester that is respresting a user state who is testing a scenario.

Running Test Case:

If you are running testcase first time in api suite, then in your api directory you will not have api tester file. You need to generate that so run following command:

codecept build

Then run

codecept run api

It will show you error or failure if at mentioned URL you will have not have intended path or functionality working. If you want to see what’s going on behind the scene for your test case then use -vv or -vvv for even more verbose.

codecept run api -vv

To know more about Codeception, simply check codeception documentation: http://codeception.com/docs/10-WebServices

However, if you want to know more about Automated testing, better ways of testing, why and how to write tests. Then I recommend reading Laravel Testing Decoded by Jeffrey Way. And if you are a PHP guy then I even strongly recommend reading this book because you will most probably be lacking something that is in this book.

You’re probably familiar with Jeffrey’s Laracast, this book is even better than that to understand Testing and follow better approaches to both development and testing.

Installing Laravel on Windows

I wrote an article on Installing LAMP environment on ubuntu cloud instance that somebody found helpful and he requested me to write for Laravel installation and configuration for Windows development machine. So here is step by step guide.

XAMPP:

I assume you have XAMPP or equivalent installed and running. If not then download it from https://www.apachefriends.org/download.html

 Composer:

Then second thing you should have is composer. Composer is a dependency manager for PHP. To check if you already have composer installed, open command prompt and type following command and hit enter:

composer –version

If you see composer version then it is installed, but if you don’t see that and instead see:

‘composer’ is not recognized as an internal or external command, operable program or batch file

Then you need to install composer. So download and install composer by following steps from here: https://getcomposer.org/doc/00-intro.md#installation-windows

Installing Laravel via Composer:

We will install Laravel using composer. But first you need to switch to your www root directory.  For XAMPP it will be htdocs folder in your xampp directory.

Type following command in command prompt and hit enter:

composer create-project laravel/laravel --prefer-dist

This will start downloading laravel and its dependencies that may take few minutes.

And it is installed. To test it hit:

http://localhost/laravel/public/

And you should see Laravel welcome screen. Once you have Laravel installed and running, Laravel website has a good documentation that you can follow. And if you want even better source than that, Laracasts is the place to start.

API Testing: Selecting Testing Framework ( PHP Unit vs Codeception vs Behat )

In previous article of this series, we discussed that why you should use automated testing, specially if you are writing APIs.  So now it is time for selecting right tools for doing our API testing.

Available Testing Framework:

As there are application development frameworks to make your life easy, there are also many different testing frameworks which can be used for automated testing. Now point is that what framework you should use? It all depends. All have their pros. Important is what you want to achieve, how much time do you have.  When I was first time writing tests to test APIs, I took  4 days from client to find tool and write test cases so that, it can save me from manually testing all API endpoints and test cases before committing my code and leaving office. Yes, if you will not have automated tool then you will need to do lot of manual testing every day.

Anyways, my project was in Laravel 4 and by doing some search on Google, I came with three PHP based testing frameworks.

  1.  PHP Unit: Because it is basic and starting from basic is easy.
  2. CodeCeption: BDD-style PHP testing framework, it was more than basic, but can be used for different sort of testing.
  3. Behat: It is a tool for Behaviour driven development. It means that test are ;written in human readable sentences that describes your application’s features.

Here is more detail about them with Pros and Cons:

PHP Unit:

PHP Unit is basic testing tool and first thing that can come to mind or (at time of writing) first record  come in Google search result if you search “PHP testing”. And PHP Unit older than all the above mentioned, its initial released was in 2004, so that means it is mature enough.

Pros of PHP Unit:

  1. It is mature and very popular and that’s why good documentation, lot of tutorials and lot of threads on Q&A boards and on forums.
  2. It is basic and basic is often simpler to start, when you are doing some thing first time or new in something.
  3. PHP Unit is probably one of the best known tool for Unit Testing, as clear from its name too.

Cons of PHP Unit:

  1. PHP Unit can be the best tool for Unit testing but API testing is different, so it is probably not better to use it for API testing or acceptance testing because, these are higher level different than Unit testing.
  2. PHP Unit is very limited. It is easy to understand the basic but if you need more than that and want to higher level stuff then either you will need to integrate different tools with PHP Unit or will need to write lot of code to write higher level tests like API testing.

Codeception:

codeception-logo

Codeception is known as BDD-style testing framework. If you go to codeception.com you will be able to see lot of different examples  for different type of testing. It is something that can fit to one’s needs in very different ways.

Pros of Codeception:

  1. It is more than basic with lot of features available for different type of testing, no matter if it is low level like Unit testing or higher level like API testing or if it is BDD.
  2. Even with lot of feature it is not that much difficult, it is easier that can be seen from homepage of Codeception.
  3. It have separate modules for many PHP frameworks like Symfony2, Laravel4, Yii, Phalcon, Zend Framework. It don’t mean that it only support these frameworks but if you are using these frameworks and use its these modules, it will provide better features like errors will be more clear, and debugging will be easier however that can result in more memory usage in some cases.
  4. It provides support for different other testing frameworks if you want to use them with it.
  5. Its Test Cases are written in PHP so programmer don’t need to know a different language for that.

Cons of Codeception:

  1. Codeception is no doubt an awesome tool but it probably don’t have as much documentation and resources compared to PHP Unit. However as it is powered by PHP Unit so one can go to that level to do something at low level too.
  2. Codeception is no doubt easier but not as much simpler and easier to configure and start as PHP Unit can be.
  3. Codeception is feature rich but it is still BDD-style tool not actually aimed at BDD and its test cases are written in PHP, so if you have a QA team who can’t write PHP then they can’t write different feature or scenarios of the system without touching PHP or programmer will need to write all those test cases.

Behat:

behat_logo

Behat is a BDD tool. And this is the purpose fo which mainly Behat is used.

Pros of Behat:

  1.  As Behat is BDD framework so it’s language for writing test cases is very human friendly and person with no programming experience can write features easily.
  2. Like Codeception, Behat is feature rich tool.
  3. Behat test cases and cleaner and maintenance of tests in Behat is easier because a layer on which test case scenarios are being written is different than where these scenarios definitions are written.

Cons of Behat:

  1. Behat is no-doubt awesome tool for BDD but for things like API testing it will probably need more tools to integrate with it.
  2. If you don’t have a separate QA team and one programmer is writing tests then writing test case scenarios and its definitions separately will be bit more complex .
  3. Programmer need to understand Behat’s human friendly syntax called Gherkin.
  4. Due to more layers involved, for programmer who haven’t used it before, it can take more time to write test cases and understanding this tool.

Conclusion:

As told above I had 4 days to look into Testing frameworks and writing some test cases for API testing and framework I was using was Laravel 4, so what I started using was Codeception. It isn’t about winner or loser, it was about which testing framework is right for you based on your requirements and time you have to learn and configure it.

I picked Codeception over PHPUnit because spending a little bit more time on configuring and learning  Codeception, I was able to save much more time during writing test cases for API Testing. And I picked Codeception over Behat because Codeception seemed to have less steaper learning curve than Behat because Codeception’s test cases are written in PHP instead of Gherkin. And I didn’t have any requirement for Gherkin (human friendly syntax) as I was the only person who was writing Test Cases.

So this was my choice based on my requirements but feel free to choose different testing framework based on your set of requirements. In next part of this series “Testing API”, we will look into how to install and configure codeception and will look into its different files and directories.

API Testing : Why to write Test Cases and use Automated Testing Tools?

Why to write Test Cases and use Automated Testing Tools?

Books written by some leading programmers often told us the importance of TDD (Test Driven Development) and BDD(Behaviour Driven Development) or they emphasize on at least writing Test Cases and doing Automated Testing. So why many programmers don’t write tests? Is that all not practical or all just too bookish, or your project life time is too small, or is it very much time consuming to write test cases? Here are few questions you will have in mind if you aren’t familiar with test cases benefits. So following are those questions answered.

Question: Obviously writing Test Cases take time and it still don’t replace manual testing, then what is the point in writing test cases. You have a QA person for that who can manually test each page then why Test Cases and this Automated Testing?

Answer: Problem is that if your QA person need to test 10 entities and 3 cases for each entity then these are simply 30 Test cases. So with every addition or modification in system, your QA person will need to test all these 30 test cases almost every day which can’t be efficiently done without automated testing.

Question: What if QA team is very efficient and can easily test lot of different scenarios, then why there should be automated testing?

Answer: Even if your QA team is very efficient, testing same things again and again is not a good use of your QA team time. QA team should design more test cases and from different perspective. And they will spend lot more time if there are different users in system are present. QA team will need to test system with different perspective by login with different accounts.

Question: Alright but it will be time consuming to write Test cases and configuring testing frameworks, so why should I not save time instead of writing Test Cases?

Answer: In long run, Test Cases will even save your time, Test Cases you have written once can be used later, and probably you will need to run tests every day after completing a feature or fixing a bug. So testing 30 Test cases is even more time consuming. If you have GUI of system then it will probably take a little less time but if  you only have APIs then it is much more difficult and error prone to test lot of APIs endpoint manually. So it is much better to spend some time on writing Test Cases instead of testing all Test Cases every day manually, so Automated Testing is lot more time saver in long run.

So it is lot better to Test system in a way where all test cases are written , can be tested under same circumstances every day, without manual dependencies once all test cases are written.

So is writing Test Cases really much time consuming?

Yes it is but it still save time. If you will need to Test something manually, you will need to perform same steps again and again for two different cases but while writing Test Cases for automated testing, you are doing all this in code. And in Code you can avoid writing same steps again by utilizing OOP  concepts and reusing code, that will definitely save time. So never be afraid of writing Test Cases. Specially when you are working on APIs then in many opinions writing Test Cases is your only option and if you will try to test APIs manually and these are not just few API calls then you will be in trouble.

So which type of Automated Testing I must use when writing API?

If you have time then better is to use Testing at every level. Do Unit, functional, Acceptance and API testing that would be helpful for debugging things. But if you don’t have as much time and you are working on APIs then you must at least do API Testing. So that if at day end some thing has gone wrong then you can test it by executing single command and know it before shipping buggy code. So it all depend on your need but if you are writing APIs then you must do API Testing other wise it will be really difficult to test different cases on different API calls manually.
To know about Automated Testing Tools selection you can find more information in my next post.

Import larger SQL files into MySQL

Larger SQL files can be imported into MySQL using different ways. I am listing 3 common ways here.

Using PHPMyAdmin by increasing upload_max_filesize:

Most  commonly used tool for MySQL is PHPMyAdmin but problem is that PHP have upload file size limit so files larger than that can’t be uploaded but in PHP Configuration file (php.ini), there is  “upload_max_filesize” limit that can be changed. So if you want to import larger file using PHPMyAdmin then you need to modify php.ini file.

You can find php.ini file path through phpinfo(). So go to php.ini, and find upload_max_filesize you will find something like:

   ; Maximum allowed size for uploaded files.
   ; http://php.net/upload-max-filesize
   upload_max_filesize=2M

Replace upload_max_filesize value with file size larger than your SQL file that you want to import. So if you want to allow file of 100 MB to be uploaded , then you should replace above line of code with:

   ; Maximum allowed size for uploaded files.
   ; http://php.net/upload-max-filesize
   upload_max_filesize=100M

Restart your server, most probably you will be using apache2. So if you are on Linux then use this command:
sudo service apache2 restart

If you are not on Linux and using some other package for PHP then restart your server accordingly. And now you should be able to upload bigger files hence you will be able to import bigger SQL files.

 

Using Command line:

Most simplest and my favorite to import  larger SQL files is command line usage because if you have access to command line then it can work almost everywhere. From your terminal or Command prompt based on Operating System (OS) you are using, execute following command:

mysql -u <username> -p<password> <DBName> < filename.sql

Here replace <username> with your DB username, <password> with your DB password, <DBName> with Database name and filename.sql with your SQL file’s path you want to import.  Please note that there shouldn’t be space between -p and password.

Using Desktop Tool:

Simply use a desktop based tool instead of PHPMyAdmin. If you are importing SQL file on a server where you can only use SSH to do anything or you are using it on a shared hosting then desktop tool is not always an option for you unless your DB is accessible from remote connection.

However if you can use Desktop based tool then you should desktop based tool as they are much more flexible and importing large SQL file is not a problem. So in this regard, there are plenty of free and paid tools. Navicat for MySQL is a nice tool but it is paid and costly. So probably you will be interested in free GUI tools like MySQL workbench.

If you guys found something unclear or some mistake in the content then feel free to let me know in comments section.

Charlie hebdo popularity on abusing religions and on few dead bodies

In the name of ALLAH who is most Beneficent and the most merciful.

A magazine that was founded around 44 years ago, was once ceased and then again relaunched after 11 years in 1992. During all that time it was making fun of beliefs (religions) of millions of people and it wasn’t widely distributed magazine. But now by more abusing the beliefs of millions of people this magazine has become much more popular and going to be distributed around the globe. Its demand is increased. But this time their publicity stunt wasn’t enough reason to make it popular. This time some people attacked on this magazine and around 12 people were killed. So this magazine who didn’t have guts to be as much popular became popular with 12 deaths attached with it on one side and Muslims as attackers on other side. So now it is enjoying popularity in the name of freedom of speech. While it should be remembered that one of the police officers killed on duty was also a Muslim.

So such a magazine who earn by making fun of religions of others can how be questioned on enjoying popularity over few dead bodies. But here the Muslims should think that what they are doing is not going to make things better. They are just making a magazine popular in whole world which was hardly known before. And what is better for a magazine than to be popular in whole world no matter if cost if hurting millions of people and few dead bodies while they know that how to gain sympathy in the name of Freedom of speech.

I don’t think this magazine deserve any sympathy. People who are running that magazine know that there are many battles in world fought for religion that mean they know that how people are touchy about their religions and beliefs even more than love of their countries, their lives and lives of their loved ones. Then hurting people by abusing their religions mean abusing them violently and getting them involved in violent activity. So if someone is responsible for all that killing, then it is this magazine named Charlie Hebdo. So if some one call himself charlie or supporting charlie hebdo should understand that (s)he actually is supporting violence, hatred, anger and killing without holding a gun in hand. Because if attackers had guns in hand then this magazine was the reason. And after all abusing millions of people’s emotions and beliefs just for fun is pointless. So anyone who is in support of charlie hebdo should think twice the reason of supporting it because this neither stand against terrorism by abusing and making fun of millions nor it is in favor of freedom of speech because freedom of abuse and speech are always different and should be differentiated.

However I was sad to see some responses at this time. Really disappointed by Mr. Mark Zuckerburg who call this act of Charlie Hebdo which was actually ruthless, as freedom of speech and he don’t even understand the difference between freedom of abuse and freedom of speech. On the other hand I want to ask Muslims to calm down and invest their time in something better because I have seen the cover of magazine at huffingtonpost website and sure that either Charlie Hebdo people are mistaken or spreading wrong words because the image they are showing on cover is not image of Prophet Muhammad (P.B.U.H) and nothing even similar to be called as his cartoon because they are not capable of drawing that. And if Muslims are still panic then they should do something to promote their religion not to promote this evil magazine which is hidden behind the banner of freedom of speech.

On the other hand every one should know that any terrorism act will not be surely by Muslims because at such times terrorists or some agencies use the name of religious parties to do something of their own. After all this is the game of monopoly.

If someone is not not agree with anything I have written then if you are a Muslim then don’t comment right now, comment after at least 5-7 days because then you will be able to see situation more clearly and if you are someone who are in support of Charlie then I can say you criminal , ruthless, terrorism creator or …. whatever and you shouldn’t mind , because you should respect my freedom of speech.

Installing LAMP on cloud instance of Ubuntu

To setup basic LAMP server on your AWS or other cloud instance, you need to connect via SSH and need to do following things which are basically related to setup lamp environment on ubuntu (Linux), for other linux distributions commands can vary:

 

update ubuntu by executing:

sudo apt-get update

 

Then install apache using following command:

sudo apt-get install apache2

After installing apache try to hit on your server IP from browser to test if Apache is installed

To install MySQL, open terminal and type in these commands:

sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql

Then type command:

sudo mysql_install_db

After this MySQL installation will begin and user will be prompted to enter password twice

After doing these things you will be installing PHP, please note that user can also install PHP before MySQL:

sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt

Above will install PHP, then after installing PHP , restart apache using following command:

sudo service apache2 restart

Although we installed PHP5 mcrypt while installing PHP, but if still mcrypt is having problem then mcrypt is probably disabled and need to enable by doing:

sudo php5enmod mcrypt

 

and then again restart apache2 so that changes take place by doing:

sudo service apache2 restart

 

To install CURL lib.

sudo apt-get install php5-curl

And again restart apache2. And after installing any library or module required don’t forget to restart apache2

Then give www-data ownership of www root directory by using following command:

sudo chown -R www-data:www-data wwwrootdirectorypath

Decide your way

Life is not a bed of roses
Neither full of thorns

We all know and understand this well, so we try to make our lives by working hard first in school, then some of us moved to college, some can’t afford it, some go to university while some have responsibilities to fulfill. It is not always us who can do what ever we want, when we want. But we always have is, the right to make decision, God has given us this right. Our these decisions can change our lives.

Some of us, in fact many of us who don’t want to waste our lives, run fast and faster nowadays towards earn money. While actually money and all that materialistic stuff doesn’t matter. What matters is our decisions, our courage to make decisions. Our decisions make our times, good , better, awesome and sometime very harsh. Still what important is to take decision, take responsibility of your life, take risk and move forward unless you don’t need to sacrifice Morality, self-respect and something other than you. Good and bad time can come to anyone, what matters is how well you live that time, that can make your upcoming time better.

What matters is what you want to do. Whether you are proceeding in life, or just wandering for earning more and more optional things which are not only things that matter. Nowadays when we go further we sacrifice what matters over just materialistic things. Even in business, what matters is your step towards your goals, not only money. In life you need to proceed. Need to cover milestones of life. Otherwise you will be standing where you are and time will not wait. However, milestones should be something that you like, it should be something that actually satisfy you. Because what make you successful is to fulfill your purpose of life. It is the way you want to live which gives you inner joy and peace because this decide who you really are.

These were some of my thoughts I shared here and I would like to see how others think. So let me know in comments, what you think?