Magento 2 is the updated version of world’s famous e-commerce framework Magento, It has various benefits as compared to its predecessor like easier site maintenance, better scalability and improved conversions. The most important improvements in respect to business point of view are the streamlined checkout and the much- enhanced Admin Panel. In Magento 2 performance is improved by implementing separate database for order processing which results in reduced amounts of code, increased browser rendering , better image compression and static content caching.
PHP7 is the updated version of PHP Scripting language. It introduced the zend Engine 3.0 which improve 2X performance and 50% better memory consumption than PHP 5.6 still its not officially released for production, so we suggest you to try this in your development environment not in the production environment.
Follow these steps to test Magento2 on PHP7.
Install LAMP stack on your server.
1 |
sudo apt-get install lamp-server^ |
Build Dependencies for php5.
1 |
sudo apt-get build-dep php5 |
Install missing packages required.
1 |
sudo apt-get install build-essential libt1-dev bison libbz2-dev libjpeg62-dev libpng12-dev libfreetype6-dev libgmp3-dev libmcrypt-dev libmysqlclient-dev libpspell-dev librecode-dev apache2-dev git |
Symlink the gmp.h file into /usr/include/ so the makefile can find it.
1 |
ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h |
Install Mysql Server 5.6 Required for Magento 2
1 |
sudo apt-get install mysql-server-5.6 |
Download the php7.0.0 source code.
1 2 3 4 |
wget https://github.com/php/php-src/archive/PHP-7.0.0.zip unzip PHP-7.0.0.zip mv php-src-PHP-7.0.0 php7 |
Now run the builconf
1 2 |
cd php7/php-src ./buildconf |
Now we have to configure the php7 source code according to Magento 2 Requirements.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
./configure \ --prefix=/usr \ --with-config-file-path=/etc/php7/apache2 \ --with-config-file-scan-dir=/etc/php7/apache2/conf.d \ --enable-mbstring \ --enable-zip \ --enable-bcmath \ --enable-pcntl \ --enable-ftp \ --enable-exif \ --enable-calendar \ --enable-sysvmsg \ --enable-sysvsem \ --enable-sysvshm \ --enable-wddx \ --with-curl \ --with-mcrypt \ --with-iconv \ --with-gmp=/usr/include/x86_64-linux-gnu \ --with-pspell \ --with-gd \ --with-jpeg-dir=/usr \ --with-png-dir=/usr \ --with-zlib-dir=/usr \ --with-xpm-dir=/usr \ --with-freetype-dir=/usr \ --enable-gd-native-ttf \ --enable-gd-jis-conv \ --with-openssl \ --with-pdo-mysql=/usr \ --with-gettext=/usr \ --with-zlib=/usr \ --with-bz2=/bin \ --with-recode=/usr \ --with-mysqli=/usr/bin/mysql_config \ --with-apxs2 \ --with-xsl \ --enable-intl \ --enable-dtrace |
After configuring and testing the source code lets build the code .
1 2 3 |
make make test make install |
Now force php to use new php, even replace the php5 binary with new php.
1 2 3 4 5 6 7 |
cd /usr/bin mv php5 php5.orig mv phpize5 phpize5.orig mv php-config5 php-config5.orig ln -s php php5 ln -s phpize phpize5 ln -s php-config php-config5 |
We need a php7.conf file into our apache mods, its better to replace the php5.conf file.
1 |
cp /etc/apache2/mods-enabled/php5.conf /etc/apache2/mods-enabled/php7.conf |
Disable php5 in apache, we can’t have php5 and php7 enabled after that restart the apache
1 2 3 |
a2dismod php5 /etc/init.d/apache2 restart |
Create a symlink by creating directory /etc/php7 with respect to /etc/php5
1 |
cd /etc/ && ln -s php5 php7 |
Now check the php version.
1 |
php -v |
After this create a file phpinfo.php into the document root directory of apache and copy the following content into that file to check the version of php integrated with apache.
1 2 3 4 5 |
<?php phpinfo(); ?> |
1 |
Note-: If you get the php version 7 in both version checks congratulations you are ready to install Magento 2 on php7. |
Now Download Magento 2 and unzip the content into Apache document root directory /var/www/html/
Change the ownership of /var/www/html directory from root to www-data by following command
1 |
chown -R www-data:www-data /var/www/html/ |
change AllowOverride None to AllowOverride All in apache2.conf for Apache Document root directory.
1 2 3 4 5 |
<Directory /var/www/html> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> |
Now enable the rewrite module by following command.
1 |
a2enmod rewrite |
Now hit the URL or IP of that Apache Server on your browser and follow the Instructions to successfully install Magento2.
1 comments