Many times, you will need to setup a new work environment such as staging or live, or you may need to setup your local development environment. To do so, the following steps would be pretty helpful for you.

If you want to remove a previous or useless installation

Install PHP 5.6 and 7.0

Install other useful PHP dependencies

For PHP 5.6

For PHP 7.0

Install Apache2

Once you have installed apache, you should install the following dependencies to link it with PHP.

For PHP 5.6

For PHP 7.0


Install MySQL 5.7

Note: If you have a previous mysql installation, you will need to remove it before starting the installation of mysql 5.6, otherwise, you will have conflicts. To remove all previous mysql installation, do the following:

Moreover, you can take a look at previous installed packages, as follows:

Both MySQL database core client and MySQL Server packages, needs to be the same version.
MySQL Client 5.5 and MySQL Server 5.5 are the current “best” versions of these packages in Ubuntu 14.04 as determined by the package maintainers, however, if you need to work with Magento 2, its mandatory to install at least MySQL 5.6

Once you have installed Apache, MySQL , and PHP. You will be able to create many virtual hosts as you want for your sites.
To create a new virtual host, you need to perform the following steps:

Make sure that the followings mods are available:

Edit your apache configuration in order to allow override and htaccess support, as follows:

Under /etc/apache2/sites-available create a file called: local.<site_name>.com.conf with the following content:

Then, you will need to enable this virtual host:

The next step, is to add the entry to your hosts file, located at /etc/hosts

Restart apache

Make a try on your browser and you should see your site (or the content of the index.php of your directory folder).


  • If you watch an error 500, take a look at your error.log file.
  • In the case you are working on Magento, and that’s your first running, it could be usual to see the following error:PHP Fatal error: Call to undefined function simplexml_load_string()To fix it, proceed with the following steps:



  • Try again, and you should see your site properly.