Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save seeamkhan/5db8de05e30b4540234835901aa555f0 to your computer and use it in GitHub Desktop.
Save seeamkhan/5db8de05e30b4540234835901aa555f0 to your computer and use it in GitHub Desktop.
PHP 5.6 Development Environment on Ubuntu 16.04

PHP 5.6 Development Environment on Ubuntu 16.04

As a PHP developer on Ubuntu, we may need to re setup our development environment sometimes. I did it already a few times, so decided to write down the steps for a typical php development environment on ubuntu. My Ubuntu version is 16.04.

Installation List

Installation PHP 5.6 & Apache2

We need to enable PPA in order to install PHP 5.6.

sudo add-apt-repository ppa:ondrej/php

Now we can install PHP 5.6 by the following commands

sudo apt-get update
sudo apt-get install php5.6 php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-xml php5.6-intl php5.6-intl php5.6-mbstring  php5.6-cli php5.6-gd php5.6-curl php5.6-sqlite3

To install Apache2, run

sudo apt-get install apache2
sudo a2enmod rewrite
sudo apt-get install libapache2-mod-php5.6

Ubuntu 16.04 comes with PHP 7 as default. If you have PHP 7 installed, it won’t activate php 5.6 module. To activate, run

a2dismod php7.0
a2enmod php5.6

Now finally restart apache, so you are done with PHP 5.6 installation.

service apache2 restart

MySQl

sudo apt-get install mysql-server
sudo apt-get install php5-mysql

PHPMyAdmin

Please follow the instruction from the link bellow to install PHPMyAdmin in your system.

https://www.ostechnix.com/install-phpmyadmin-with-lamp-stack-on-ubuntu-16-04/

CURL

sudo apt-get install curl

PHP Storm IDE

You need to first install Oracle JDK in order to install PHP Storm. If you want to use SmartGIT 17.1.2 in your system then install JDK 8, otherwise you can install latest JDK 9.

Install Oracle JDK 8

First, update the package index.

sudo apt-get update

Then, add Oracle's PPA, then update your package repository.

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update

To install JDK 8, use the following command:

sudo apt-get install oracle-java8-installer

During the installation process you will need to accept the Oracle License agreement. Once installed we need to set Java environment variables such as JAVA_HOME on Ubuntu 16.04/17.04.

sudo apt-get install oracle-java8-set-default
source /etc/profile

You can check the configured JAVA_HOME value by running the command bellow.

echo $JAVA_HOME

Install PHP Storm

First go the official website and download the tar archive. Extract the archive in your system and you will get a folder like ‘PhpStorm-172.4155.41’ (latest version at the time of writing this). Then go to the location where you downloaded it from the command line and move the folder to /opt/phpstorm following the command below.

sudo mv PhpStorm-172.4155.41/ /opt/phpstorm/

Create a symlink

sudo ln -s /opt/phpstorm/bin/phpstorm.sh /usr/local/bin/phpstorm

Now type phpstorm in the terminal to launch the application.

phpstorm

Follow the installation instruction of Importing from previous installation and Privacy Policy. Then choose the ‘Evaluate for fee for 30 days’ option and complete the installation.

After installation, opent the IDE and activate the license.

Go to Help > Register

Choose the 'License Server' option and use this URL as the license server, http://idea.imsxm.com

Click Activate, and you are done! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment