TECH

Vol.36

author

Engineer

Y.M.

How to Install PHP 7 — The First Major Update in 11 Years!

#WEB#programming#マクロ開発#webサイト#Web application

On December 4, 2015, PHP 7, the programming language, was officially released.
This marks the first major version update in 11 years for PHP.
PHP 7 is expected to deliver significant performance improvements for server-side scripting in web applications.

stuffstuff

Key Features of the New PHP 7

Key Features of the New PHP 7

  • Improved performance, including reduced memory consumption
  • Faster processing speed
  • Implementation of new features such as scalar type declarations
  • Removal of features deprecated as of PHP 5.6
  • Changes that are not backward compatible

And more.

For more detailed information about these features, please refer to the official PHP migration guide.

Migrating from PHP 5.6.x to PHP 7.0.x

PHP 7 is expected to bring major performance improvements to websites and web applications.
I wanted to experience it as soon as possible, so I decided to install it on the server right away.
Since the environment used in this article already had the RC6 development version installed, we first uninstall it and then perform a fresh installation.

Installed version
PHP 7.0.0

LAMP environment configuration before installation

OS (Linux) CentOS 7.1
Web Server nginx 1.8.0
CGI (PHP) PHP 7.0.0RC6
Database MariaDB 10.1.8

Uninstalling PHP

PHP was already installed in the environment used for this setup, so we decided to uninstall it first and then perform a fresh installation.
To uninstall PHP, use the yum remove command.

# yum remove php

Related dependency packages will also be removed.
In this case, a developer version had previously been force-installed using an external repository, and it could not be removed with the above command, so the following command was used instead.

# yum --enablerepo=remi-php70 remove php\*

You can confirm that PHP has been uninstalled using the rpm command.

# rpm -q php

You can also verify it by checking the PHP version.

# php -v

If neither command displays version information, the uninstallation was successful.
This confirms that PHP has been completely removed.

Installing PHP 7 from Scratch

To install the latest version, you first need to add an external repository.
Download the latest REMI repository and install it using the rpm command.

# wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
# rpm -Uvh remi-release-7.rpm

*The -Uvh options used with the rpm command mean the following:
U = update/install package
v = verbose output (detailed information)
h = display installation progress
Using the U option is acceptable even for a fresh installation.

Next, install PHP using the yum command.

# yum -y install --enablerepo=remi-php70 php php-mbstring php-mysqlnd php-fpm

*Including the -y option in the yum command skips the confirmation prompt and immediately starts the installation after downloading the packages.

Once the installation is complete, verify it with the following commands.

# rpm -q php
# php -v

If the following kinds of outputs are displayed, the installation was successful.

# rpm -q php
php-7.0.0-1.el7.remi.x86_64
# php -v
PHP 7.0.0 (cli) (built: Dec 1 2015 17:53:27) ( NTS )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies

Finally, upload a phpinfo() file to the server and verify that PHP is working correctly through the web server.

Image showing verification after uploading to the server

Bonus Tip

Isn’t There a PHP 6?

This article assumes that PHP 7 is the latest version, but have you noticed that the previous version being compared is PHP 5?
So what happened to PHP 6?

In short, PHP 6 was abandoned.
During the development of PHP 6, there was apparently a plan to “implement all internal string handling in UTF-16.”
However, the implementation became too complex while offering little practical improvement, and the project itself eventually stalled.
After changing direction, development restarted under a new version number, which is why the next release became PHP 7 instead of PHP 6.
There is an article summarizing the details, so please refer to the following link for more information.

Reference Site
PHP 6 Development Abandons UTF-16, Rolls Back to 5.3 (2010/3/17)

Mascot Character

The PHP mascot character “elePHPant”

This is the PHP mascot character, “elePHPant.”
It is not particularly famous, though...
But why is it an elephant in the first place?

Apparently, the reason is that when you stylize the letters “PHP,” they resemble an elephant.
Once you look at the shape and flow of the letters, it really does start to look that way.
We have included some reference links below for anyone interested in learning more about the history behind the creation of elePHPant.

An origami template for elePHPant has also been released.

Reference Sites
Why the PHP Mascot Character “elePHPant” Is an Elephant
How & Why Did The PHP Mascot Come To Birth? Creator Of The elePHPant Vincent Pontier Reveals The True Story! (English)
Elroubio (“elePHPant” page)

Summary

PHP was released on December 3rd, slightly later than originally scheduled.
The installation process on the server itself is not particularly difficult.
Although PHP 7 promises major performance improvements, some specifications have changed from PHP 5, so when introducing it into a production environment, it is recommended to carefully check the specifications of currently running CGI programs and web applications before updating.

HHVM, which is often compared with PHP 7, appears to maintain a high level of compatibility with the previous PHP 5 series.
If you are considering improving processing speed for PHP-based systems, HHVM may be another option worth considering besides upgrading directly to PHP 7.

In our environment, we installed PHP 7 and tested WordPress.
At present, there have been no major issues such as the site failing to display entirely, and normal operation appears unaffected.
However, if plugins are installed, some may not yet be compatible, meaning you may need to wait for updates or modify the programs yourself.

We are continuing our verification process in this environment, and if we discover anything noteworthy, we plan to introduce it in another article.

Next time, we will focus on the question: “How do you build a web server environment?”
We will introduce the configuration and setup procedures of the environment we are currently building.

References:
Removing Packages
rpm Command Options
PHP 7 Installation Procedure

PREV
Vol.3510 Types of Paper Perfect for 20…
NEXT
Vol.37The History and Characteristics …

MORE FOR YOU