Category Archives: Technology

Use phpmyadmin with nginx and php7

phpmyadmin page

Install the phpmyadmin following the normal application installation

Install phpmyadmin

sudo apt-get install phpmyadmin

Follow the normal installation process of phpmyadmin. Once the
phpmyadmin configuration is finished, we need to configure the
nginx configuration.

Nginx Configuration

Edit the nginx configuration (/etc/nginx/sites-available/default)
and add the following configurations to it.

# Phpmyadmin Configurations
    location /phpmyadmin {
       root /usr/share/;
       index index.php index.html index.htm;
       location ~ ^/phpmyadmin/(.+\.php)$ {
               try_files $uri =404;
               root /usr/share/;
               #fastcgi_param HTTPS on; # <-- add this line
		       fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
               fastcgi_index index.php;
               fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
               include fastcgi_params;
       location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
               root /usr/share/;
   location /phpMyAdmin {
       rewrite ^/* /phpmyadmin last;

php7 and php-gettext symbolic links

Since php7 by default do not come with php-gettext we will need to install
these packages too.

sudo apt-get install php-gettext

If this package is not available then you will see following error messages
in your nginx error logs in /var/log/nginx/error.log

2016/04/28 10:22:30 [error] 17184#0: *6 FastCGI sent in stderr: “PHP message: PHP Fatal error: require_once(): Failed opening required ‘./libraries/php-gettext/’ (include_path=’.:/usr/share/php’) in /usr/share/phpmyadmin/libraries/select_lang.lib.php on line 395” while reading response header from upstream, client:, server: localhost, request: “GET /phpmyadmin/ HTTP/1.1”, upstream: “fastcgi://unix:/var/run/php/php7.0-fpm.sock:”, host: “localhost”

Once php-gettext is installed use the below command to reconfigure the
symbolic links to gettext.

rm /usr/share/phpmyadmin/libraries/php-gettext/*
ln /usr/share/php/php-gettext/* /usr/share/phpmyadmin/libraries/php-gettext

Restart the nginx server

sudo service nginx restart

Browse http://localhost/phpmyadmin and it should show up the phpmyadmin login page.
– You may have to hard refresh to get to the page, since browser caches this page.


[HowTo] Change theme in vim

This is a walkthrough on how we can change the color theme in vi.

Basically Colortheme in vi are placed in ~/.vim/colors folder by default. This path is configurable through vi configurations. For this post, I assume the folder is “~/.vim/colors”. We’ll use 256 color enabled color theme. So you’ll also need to enable 256 color for your terminal editor.

Enable 256 Color mode in vi.

$ vi ~/.vimrc

Enter “set t_Co=256” and save it.

set t_Co=256

On next start of VI it will load at 256 colormode. If somehow you can’t see any change in colormode, try to find ways to enable 256 color mode. For this post, we’ll use “” theme.

Create “~/.vim/colors” folder if it doesn’t exits. Then use below command one by one.

$ cd ~/.vim/colors
$ git clone tayra
$ cp tayra/*vim .

All we did was cloned “tayra” theme from git then copied over everything from tayra folder with .vim extension to the “~/.vim/colors” folder. Now to test it open vi and use the following command to test it.

$ vi ~/.vimrc

One inside vi type “:colorscheme tayra” it should change the current theme to “Tayra”.

Now, you can look for new themes in vi and come to love the one you love.

How to keep your forked repositories in sync with the source repository

This blog post aims to answer the following questions.

  • How to contribute to Open Source Projects (Partially)?
  • How to keep forked repositories in sync with the source repository ?
  • How to pull the commits from source repository to the forked repository?

I often forked open source repositories found in github and also commit back to the repositories whenever I feel to. However, this may seem obvious who has been doing these kind of thing. But for someone who is completely new this is kind of mess and it’s hard to figure out the right way to do it at first. So, I do not claim that the way I show here is right. I am just showing how I do it my way and would like to share it with others.

I have forked repository from github repo. I already have it cloned in my local repository. I had forked it long ago. So, when I get back to the forked repo, I get a message saying that My repository is 3 commits behind.


Now, before I can contribute to the main repo I have to first sync up my repo with the forked one. To do that I have to bring in all the commits that are missing from my repo, those commits are as follows:

  • Add PHP School to intro FAQ
  • Add Snappy library
  • Add packages to work with screenshot APIs

I get inside my forked repository i.e.


is the folder that I have my forked repo on my local machine. So I use

$ cd php-faq

to get inside the folder. Inside the folder as you can see below “git remote -v” displays the “origin” as the remote.

To be able to pull in changes, I will add another remote which is my forked repository. I use

git remote add wwphp

Now when I do

$ git remote -v

it will display origin and wwphp under remote list.

Git Remote Add

Now, I fetch all the meta information from the newly added repo i.e. wwphp. I am only interested in the master branch and thus fetching information from that particular branch only.

git fetch wwphp master

Now, to see the commits that my repository is missing I use

$ git log --oneline origin/master..wwphp/master --left-right

Fetch metainformation from remote repository

It basically lists out all the commits that are in wwphp/master branch but no in origin/master (my forked repository).

We can see that we don’t have above 3 commits on my forked repository.
Commits on current repo

Just to confirm:
Commits on current repo

Now, to pull in the commits that my repo is missing I will use

$ git merge wwphp/master

Merge github commits from remote repo to forked repo

To confirm that we have successfully pulled in the commits we can see the “git log” output. The above output message “Your branch is ahead of ‘origin/master’ by 3 commits.” are shown because I haven’t pushed them to my forked repo on github. Once I push the currently made changes to my github repo then this message will stop showing up.

View merged commits

Finally push all the newly introduced commits to my forked repository.
Final push to the github

Now, the message has changed from “3 commits behind” to “branch is even” which means that we have successfully pulled in all the commits from remote repo to our forked repositories.


Instead of “git fetch wwphp master” we can also use “git fetch master” similarly we can use “git pull master”. However, I would suggest you use the fetch and then see the commits that will come in and whether you would like to merge or not.

Let me know if you have any confusions on this. I will try to answer them.

Happy forking :)

Nepal gets a new constitution 2072


Today, Nepal got its most awaited constitution 2072. Being Nepali this is proud moment for me and for all Nepalese. There has been clashes between political leaders, parties. Despite all the shortcomings they gave us the constitution 2072. I hadn’t expected the constitution would come so sooner. 

Here is my facebook status.

Congrats to all of us ‪#‎Nepalese‬ for the new constitution 2072. Celeberation begins smile emoticon with Asee Shrestha being an Engineer eight years is not a long span for something that has to do with country’s revolution. Once again thanks to all the political parties, leaders who showed their active participation in this historical moment.