Magento 2 is the new version of Magento framework which has many changes and advantages as compared to previous versions like site maintenance, easy to handle dashboard, obviously fast performance etc. The main and important aspects are the enhanced Admin Panel, separate tables for order processing, better image compression by default, static content caching etc.
PHP7 is an improved version of PHP Scripting Language which is ready for development and production environment. It has 2x faster performance and more than 50% lower memory consumption than previous PHP 5.6 version.
In this tutorial, we are going to use EasyPHP DevServer v16.1 (you can also use the latest version if it has been released) which includes Apache 2.4.17, PHP v7.0.1, PhpMyAdmin v4.5.2 and MySQL v5.7.9. Download and install it and make sure to set the path of PHP.EXE and PHP.INI in the Environment Variable. Also we are going to install Composer. Magento is now using Composer for dependency management. Composer enables Magento 2 to manage its components and dependencies. Download Composer via this link and install it.
We selected EasyPHP DevServer on the basis of official system requirements of Magento 2. Here are the official Magento 2 system requirements:
Apache 2.4 or 2.2 (In addition, the apache mod_rewrite module must be enabled. mod_rewrite enables the server to perform URL rewriting)
nginx 1.8 (or latest mainline version)
5.5.x (Magento no longer supports PHP 5.4.x)
Before you begin Magento 2 installation on your localhost, you should know that Magento 2 requires some extensions support for PHP7. Make sure you have the following PHP7 extensions installed and enabled on your EasyPHP DevServer:
- imagick or ImageMagick 6.3.7 or later
For more information about Magento 2 system requirements, visit Magento official website.
We are now ready to install Magento 2 on our local server. Here are the steps to follow:
Download Magento 2 zip file from official download page.
Start your EasyPHP DevServer. Right click on EasyPHP DevServer icon in Taskbar and click Open Dashboard.
On Dashboard, click start button below HTTP Server, Choose Apache as Server, Select PHP v7.0.1, Port 8888 and press start button.
Return to Dashboard, now click start button below DATABASE Server, choose MySQL as Server and press start button.
Return to your Dashboard and click on Portable Directory Link to explore the directory here we have to extract/unzip Magento 2 files and folders from the downloaded zip file. This is also known as ROOT Directory of your local server and in the rest of this article, we’ll refer to this directory as “ROOT”.
Create a new folder magento2 in ROOT and extract all the files and folders from the zip file to this directory using 7-Zip file archiver.
Go to your EasyPHP DevServer Dashboard, open PhpMyAdmin and create a new database – “magento2”.
Now we are ready to install Magento 2 on our local server. To access Magento installation/setup, enter your Magento 2 URL in your favorite web browser and hit enter. You’ll be automatically landed on the start page of Magento Setup, then click “Agree and Setup Magento”.
Starting the Magento 2 Browser Installer
In this step, Magento will perform Readiness Check on your environment which includes PHP Version Check, PHP Settings Check, PHP Extension Check and File Permission Check. If you get any errors, you must resolve them in order to continue the setup.
In this step, Magento will ask you for some database details. Enter database server host “127.0.0.1”, username “root” and an already created database name “magento2”.
Step 3 will ask for web configurations where you have to enter your Store Address and Admin URL. Change your Store Address (it may be set by default), and admin URL depends on what you wish.
In this “Customize Your Store” section, you can select your timezone, currency and language of the future test Magento 2 store.
Enter Username, Email Address and Passwords to setup your Admin Panel’s credentials.
Are you ready to install Magento 2 on your local server? Click “Install Now” and wait for a few mins.
NB: Do not close your browser until the setup is done and a success page appears!
A “Success” message will appear which will indicate the successful installation of Magento 2 on your local server but wait, it’s not over yet. Do not open your store address or admin panel URL. There are a few more things to do.
Now we are going to verify composer installation, deploy static content, clear/flush Magento cache and reindex the Magento 2 blocks by using Magento 2 CLI Commands. If you need to know more about it, read this article. To perform all the actions mentioned above, press WINDOWS KEY + R to open RUN dialog and type “cmd” to open Command Prompt.
Type “cd PATH_TO_YOUR_MAGENTO2_FILES” to enter the Magento 2 ROOT directory.
Now, to verify Composer installation in the directory mentioned above, type “composer install”.
NB: If you get any error in this step, please double check your Composer installation.
In this step, we are setting up static content to deploy on our Magento store. To perform this, type “php bin/magento setup:static-content:deploy”.
NB: If you get any error, check your PHP.EXE and PHP.INI Environment Variable.
Clear/Flush Magento 2 cache by typing “php bin/magento cache:flush” in the CMD.
And finally, to Reindex Magento Static Blocks type “php bin/magento indexer:reindex”.
Please visit your store address to access Frontend and your admin panel URL to access Admin Panel of your Magento 2 store.
We are done with Magento 2 setup and installation on your localhost. If you faced any problem, feel free to share it and comment below. Enjoy using Magento 2 with PHP7 configuration and discover the exclusive features of the new platform!