Today I updated the version of PHP I use in my development environment, from PHP 7.1.1 to PHP 7.2.0. I then raised GitHub Issues for each of the problems I found running my PHPUnit tests. New versions of a number of my plugins will be available soon.
- PHP 7.2 was released on 30th November 2017.
- WordPress recommends PHP 7.2.
- Some hosting companies already support PHP 7.2.
- So my plugins and themes should do too.
- Active support for PHP 7.0 ended on 3rd December 2017.
Original environment: Windows 10, Apache 2.4, MySQL something and PHP 7.1.1 and PHP 7.0.7.
- Download the ZIP file ( Thread safe 64-bit )
- Unpack to a new directory C:\php72
- Copy and cobble the php.ini file from C:\php71
- Add a new batch file to select PHP 7.2
- Restart Apache
- Test that PHP 7.2 works
- Test plugins and themes
- Fix any problems
Changes to php.ini
When I first ran PHP 7.2 I’d simply copied the php.ini from c:\php71. I got this message. Deprecated: Directive ‘track_errors’ is deprecated in Unknown on line 0 Solution: comment out the setting.
Batch file to select PHP 7.2
When I upgraded to PHP 7.1 I developed a batch file to switch between 7.0 and 7.1. I’ve written a new one for 7.2, called p72.bat
@echo Switching to PHP 7.2 set ORIGINAL=%CD% c: cd \ rmdir C:\php mklink /J C:\php C:\php72 cd C:\php php -v cd %ORIGINAL%
Test that PHP 7.2 works
C:\php72>php -v PHP 7.2.0 (cli) (built: Nov 28 2017 23:48:49) ( ZTS MSVC15 (Visual C++ 2017) x64 ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.2.0, Copyright (c) 1999-2017, by Zend Technologies
So far, the places where I’ve seen problems have all been in my local development environment.
|Problem||Fix & Reference|
|Warning: count(): Parameter must be an array or an object that implements Countable||bobbingwide/oik-bwtrace#55 bobbingwide/oik#91 bobbingwide/oik-libs#9|
|Deprecated: Function create_function() is deprecated in wordpress-beta-tester\wp-beta-tester.php on line 207||Update plugin to v1.2.0|
|Deprecated: __autoload() is deprecated, use spl_autoload_register() instead in wp-includes\compat.php on line 502||Update WordPress from 4.7.3|
|Deprecated: Function create_function is deprecated in makeoik.php||bobbingwide/oik-i18n#1|
|Deprecated: Function create_function() is deprecated in oik-css\geshi\geshi.php on line 4751||bobbingwide/oik-css#5|
|Fatal error: Cannot use ‘Object’ as class name as it is reserved||bobbingwide/wp-top12#5|
|Fatal error: Uncaught Error:  operator not supported for strings in buddypress\bp-activity\bp-activity-loader.php||Upgrade BuddyPress from 2.4.4 to latest version: buddypress/BuddyPress|
|PHP for Windows downloads||http://windows.php.net/download|
|PHP 7.2.0 VC15 x64 Thread Safe (2017-Nov-29 02:03:13)||http://windows.php.net/downloads/releases/php-7.2.0-Win32-VC15-x64.zip|