PHP 7 to PHP 5.6 downgrade on Ubuntu 16.04

Hey there!!

Writing after quite some time. I forgot why I used to write and hence the blogs didn’t update. So here I go again!!

So, I recently did an upgrade from my good old Ubuntu 14.04 to Ubuntu 16.04 and as a web developer, I obviously have the LAMP stack installed in my system. So what happened during the upgrade was that my system updated php from 5.x to 7.0(not stable at the time of writing this post!) which is default in Ubuntu 16.04 (found this after quite some time of research!)

I had to downgrade due to some very special reasons. One of them might have been that my production server did not have the super efficient php7 engine and hence was running out of memory on a recursive function. I had to replicate the error on my local machine but with PHP7, I was not running out of memory (even with the same memory limitations. I am happy and sad at the same time now!!)

So I took the decision to downgrade.
Continue reading “PHP 7 to PHP 5.6 downgrade on Ubuntu 16.04”

www to non-www redirection using htaccess

A simple way to redirect the URL from to without making any changes to the server will be to use htaccess.

So, I am sharing code for the same.

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

Paste this code in your .htaccess file in your home directory and voila!!

Check and enable mod_rewrite if htaccess not working

So, I faced this issue, ny htaccess was not working and my API was pathetically useless because of this.
So I decided to check this with my server.

Create a PHP file on the Apache server. Write the below code inside it.


Now call the file in your browser (This means, put the file URL in the browser and press ENTER).
Once done, you will see info about your php. Press Ctrl+F and search for “mod_rewrite”.
If present, then please do not read any further as your issue is then different from mine.
Continue reading “Check and enable mod_rewrite if htaccess not working”