• English
  • Nederlands

User Tools

Site Tools


PHP 7 support

This page is a collection of questions / solutions for PHP7 implementation

Open problems

  • none at 2016-01-26


The code to check the PHP version should be changed so that version 7.0 is accepted.

  • Script weather28/jpgraph/src/jpgraph.php
  • lines 230-242
  • function CheckPHPVersion
  • add the extra line
function CheckPHPVersion($aMinVersion) {
    list($majorC, $minorC, $editC) = preg_split('/[\/.-]/', PHP_VERSION);
    list($majorR, $minorR, $editR) = preg_split('/[\/.-]/', $aMinVersion);
    if ($majorC > $majorR) return true;                  // this line added for PHP7
    if ($majorC != $majorR) return false;
    if ($majorC < $majorR) return false;
    // same major - check minor
    if ($minorC > $minorR) return true;
    if ($minorC < $minorR) return false;
    // and same minor
    if ($editC  >= $editR)  return true;
    return true;

As debug options are set to high when testing the template, switch them off for the graphs at

  • Script weather28/wxgraphs/graphsconf.php
  • lines 29
  • function fetch_root
  • add the extra line after the include of uor template settings files
        include '../wsLoadSettings.php';   //  NEXT line added for PHP7
        ini_set('display_errors', NULL);  error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED); 

Setting the debug options on will reveal other deprecated messages. They are not real errors, only messages that in the future these "old ways of doing things" need to be redone the modern way. But for now the graphs are correctly drawn.

WU history

In one case the ereg_replace function is used. It should be replaced with a str_replace

  • Script weather28/wu/WU-history.php
  • lines 1406
  • function getcsvWithoutHanging
  • change that line from
$line = ereg_replace("<br>", "", fgets($socketConnection, 4096));  //One of these gets left in there somehow


$line = str_replace("<br>", "", fgets($socketConnection, 4096));  //One of these gets left in there somehow
en/php7.txt · Last modified: 2016/01/28 16:33 by wvdkuil