PHP 7.2 is available on all shared hosting tariff plans

As before, we focus on the development of technologies, as well as on the optimization and stability of the technologies used.

This time we have updated PHP to the latest stable version 7.2 and wish to tell you about the changes. Of course, there are not many changes compared to version 7.1.

Performance related improvements come first

With each update, PHP becomes faster, more stable and more efficient in terms memory usage. This new update contains several changes, thanks to which the new version of PHP 7.2 is slightly faster than PHP 7.1.

The list of changes in the new version contains the following performance optimizations:

  • Global optimization based on data flow analysis using SSA (Static single assignment form) was added to Opache: Sparse Conditional Constant Propagation (SCCP), Dead Code Elimination (DCE), and removal of unused local variables.
  • The built-in function in_array() has been optimized by searching for a hash in an inverted array.

Updates

  • New cryptographic extension Sodium was added. Make Libsodium a Core Extension RFC was adopted, which proposed to include the Libsodium library in the PHP kernel, which in turn provides authenticated encryption, high-speed elliptical cryptography, and more.
  • Json_invalid_utf8_ignore and JSON_INVALID_UTF8_SUBSTITUTE options have been added to the json_encode and json_decode functions to ignore or replace invalid UTF-8 byte sequences.
  • Extensions are now allowed to be loaded in ini files by name (extension=).
  • The mcrypt extension, which was declared deprecated in PHP 7.1, has been moved to PECL.
  • The minimum supported version of Windows is now Windows 7/Server 2008 R2

Deprecated features

  • __autoload - this magic function was replaced with spl_autoload_register in PHP 5.1, and is now deprecated
  • $php_errormsg — this variable was created in the local scope in the event of non-fatal error, if track_errors option was enabled in ini file (disabled by defaulted), and in this case the error was not passed to the error handler.
  • create_function() - the function is essentially a thin wrapper over eval(), as a result it is very slow, uses a lot of memory in operation and is a source of potential security threats.
  • mbstring.func_overload is an ini setting that allows you to override some string functions with their multibyte counterparts. This function is not allowed in some libraries (such as Symfony) and can cause problems under certain conditions.
  • (unset)cast - this conversion reverts the result to null. In fact, the expression (unset)$x does not carry any additional meaning and can be confusing, because it is not equivalent to the unset($x) function.
  • parse_str() with no second argument is a relic from the days of register_globals. Without passing the second argument, the function assigns the resulting values to local variables, which can potentially be unsafe.
  • gmp_random() – starting from version 5.6, the gmp_random_bits() and gmp_random_range() functions, which have more control over the result, have been introduced to replace gmp_ramdom().
  • each() is analogous to foreach, but much slower.
  • assert() with string argument - when passing a string value to assert, eval is executed on the string, which is a potential threat to application security.
  • $Errcontext argument in error handler - previously, $errcontext containing an array of all local variables at the time the error occurred could be passed to the error handler specified by set_error_handler().

In the new version of PHP, some old functions are declared deprecated, and will start showing deprecation notice:

In General, the list of changes is not as impressive as the transition from PHP 5 to PHP 7, but still, as you can see, the trend to improve performance persists, and that is good news.

Next, we demonstrate how you can enable PHP 7.2 in your hosting control panel.

As before, switching version is carried out in just a few clicks.

In the hosting control panel, go to the WWW section, then go to the WWW-domains subsection, select the domain on which you plan to install PHP version 7.2 from the list and press the Change key. In the window that appears, in the line PHP Version, select PHP 7.2.2 (alt) from the list.

Shared Hosting with PHP 7.2