Author Topic: Switched Server Provider Now Fatal Error Solved  (Read 1413 times)

0 Members and 1 Guest are viewing this topic.

Offline yamiacaveman

  • Forecaster
  • *****
  • Posts: 439
    • Penn Lake Weather
Switched Server Provider Now Fatal Error Solved
« on: September 11, 2017, 08:39:21 PM »
pennlake.us

Today I switched server providers - Both use c-panel and I did a complete backup of my site and then well basically handed it off to the other provider, also uses c-panel.

So Using PHP 7.1or 7.0 I get this Fatal Error:
Fatal error: Uncaught Error: Class 'DOMDocument' not found in /home/hogan2/pennlake.us/get-aqi-rss.php:18 Stack trace: #0 /home/hogan2/pennlake.us/get-aqi-rss.php(8): getAQIdata('http://feeds.en...', 'realtime') #1 /home/hogan2/pennlake.us/ajax-dashboard6.php(111): include_once('/home/hogan2/pe...') #2 /home/hogan2/pennlake.us/index.php(98): include_once('/home/hogan2/pe...') #3 {main} thrown in /home/hogan2/pennlake.us/get-aqi-rss.php on line 18

Using PHP version 5.6 I get this error:
Fatal error: Class 'DOMDocument' not found in /home/hogan2/pennlake.us/get-aqi-rss.php on line 18

My original server used PHP version 7.1

So, as most of you know, this is way above me, so any help would be very much appreciated.

« Last Edit: September 13, 2017, 05:07:48 PM by yamiacaveman »

Offline Jáchym

  • Meteotemplate Developer
  • Forecaster
  • *****
  • Posts: 8605
    • Meteotemplate
Re: Switched Server Provider Now Fatal Error
« Reply #1 on: September 12, 2017, 02:15:56 AM »
This is a missing class, classes are defined by scripts so to me this looks like rather some script hasn't been copied or this one is corrupted (incomplete)

Offline yamiacaveman

  • Forecaster
  • *****
  • Posts: 439
    • Penn Lake Weather
Re: Switched Server Provider Now Fatal Error
« Reply #2 on: September 12, 2017, 07:39:20 AM »
Thanks Jachym, and by the way your Meteotemplate seems to have made the transition just fine!!!

With your info I think I will start replacing the scripts, perhaps something will get corrected.

Thanks for the response!!

Offline Jáchym

  • Meteotemplate Developer
  • Forecaster
  • *****
  • Posts: 8605
    • Meteotemplate
Re: Switched Server Provider Now Fatal Error
« Reply #3 on: September 12, 2017, 07:56:30 AM »
First try re-uploading:

get-aqi-rss.php

if that does not help, post here the script you are using

Offline yamiacaveman

  • Forecaster
  • *****
  • Posts: 439
    • Penn Lake Weather
Re: Switched Server Provider Now Fatal Error
« Reply #4 on: September 12, 2017, 10:08:31 AM »
<?php
//Current Air Quality URL
$urlRealtime = "http://feeds.enviroflash.info/rss/realtime/591.xml";  //Wilkes Barre / Scranton, PA
// Images Directory
$imagesDir = "./ajax-images";

// GET THE DATA FROM URL
getAQIdata($urlRealtime, "realtime");


//// FUNCTIONS
// Data aquisition
function getAQIdata($AQIurl,$type) {
   global $$type;

   $$type = array();
   $typeA = $type;
   $typeA = new DOMDocument();
   $typeA->load($AQIurl);
   foreach ($typeA->getElementsByTagName('item') as $node) {
      $itemRSS = array (
         'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,
         'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue,
         );
      array_push($$type, $itemRSS);
   }
}   

// strip out the needed data
preg_match('|<br /><br />\n(.*) - (.*) AQI - (.*)<br />\n|Uis', $realtime[0]["desc"], $r3);
$realIndex2 = 'N/A';
$realValue2 = 'N/A';
$realMeasure2 = 'N/A';

// search for two AQI types
if(preg_match('|<br /><br />\n(.*) - (.*) AQI - (.*)<br />(.*) - (.*) AQI - (.*)</div>|Uis', $realtime[0]["desc"])) {
   preg_match('|<br /><br />\n(.*) - (.*) AQI - (.*)<br />(.*) - (.*) AQI - (.*)</div>|Uis', $realtime[0]["desc"], $r3);
   $realIndex2 = trim(strip_tags($r3[4]));
   $realValue2 = trim(strip_tags($r3[5]));
   $realMeasure2 = trim(strip_tags($r3[6]));
}

$realIndex1 = trim(strip_tags($r3[1]));
$realValue1 = trim(strip_tags($r3[2]));
$realMeasure1 = trim(strip_tags($r3[3]));

// get the last update
preg_match('|Last Update: (.*)</i>|', $realtime[0]["desc"], $r4);
$realUpdate = trim(strip_tags($r4[1]));

// arrays for comparing levels and values
$aqiValues = array('0-50', '51-100', '101-150', '151-200', '201-300', '301-500');
$aqiLevels = array('Good', 'Moderate', 'Unhealthy for Sensitive Groups', 'Unhealthy', 'Very Unhealthy', 'Hazardous');
$aqiGraphic = array('aqi_good_text.gif', 'aqi_mod_text.gif', 'aqi_usg_text.gif', 'aqi_unh_text.gif', 'aqi_vunh_text.gif', 'aqi_haz_text.gif');  ////////////////////////////////////////////


// Associate AQI level with graphic icon
function getGraphic($value, $levels, $graphic, $iDir) {
   global $levelImage;
   
   $var = array_search($value, $levels);
   if($value !== 'N/A') {
      $levelImage = "<img src=\"".$iDir."/".$graphic["$var"]."\" alt=\"".$levels["$var"]."\" title=\"".$levels["$var"]."\" border=\"0\" />";
      echo $levelImage;
   }
   else {
      $levelImage = "<img src=\"".$iDir."/aqi_nodata_text.gif\" alt=\"No Data\" title=\"No Data\" border=\"0\" />";
      echo $levelImage;
   }
}
   
////  END OF FUNCTIONS

?>

Offline yamiacaveman

  • Forecaster
  • *****
  • Posts: 439
    • Penn Lake Weather
Re: Switched Server Provider Now Fatal Error
« Reply #5 on: September 12, 2017, 11:26:46 AM »
So here are other Page Errors I found while going through my site.

Forecast

Fatal error: Uncaught Error: Call to undefined function json_decode() in /home/hogan2/pennlake.us/advforecast2.php:420 Stack trace: #0 /home/hogan2/pennlake.us/wxforecast.php(78): include_once() #1 {main} thrown in /home/hogan2/pennlake.us/advforecast2.php on line 420

Air Quality

Fatal error: Uncaught Error: Class 'DOMDocument' not found in /home/hogan2/pennlake.us/wxaqirssV2.php:287 Stack trace: #0 /home/hogan2/pennlake.us/wxaqirssV2.php(96): getAQIdata('http://feeds.en...', 'forecast') #1 {main} thrown in /home/hogan2/pennlake.us/wxaqirssV2.php on line 287

Earthquake Activity

Fatal error: Uncaught Error: Call to undefined function json_decode() in /home/hogan2/pennlake.us/quake-json.php:380 Stack trace: #0 /home/hogan2/pennlake.us/wxquake.php(135): include_once() #1 {main} thrown in /home/hogan2/pennlake.us/quake-json.php on line 380

Almanac/Noaa Image of the day

NOAA Image of the Day

Fatal error: Uncaught Error: Call to undefined function imagecreatefrompng() in /home/hogan2/pennlake.us/get-nnvl-iod.php:345 Stack trace: #0 /home/hogan2/pennlake.us/get-nnvl-iod.php(266): NNVL_loadPNG('./cache/IOD-ima...') #1 /home/hogan2/pennlake.us/wxnoaaiod.php(52): include_once('/home/hogan2/pe...') #2 {main} thrown in /home/hogan2/pennlake.us/get-nnvl-iod.php on line 345

NOAA Pages/ Near term temp outlook

atal error: Uncaught Error: Call to undefined function imagecreatetruecolor() in /home/hogan2/pennlake.us/wxcpcoutlook.php:154 Stack trace: #0 /home/hogan2/pennlake.us/wxcpcoutlook.php(74): make_white_box() #1 {main} thrown in /home/hogan2/pennlake.us/wxcpcoutlook.php on line 154

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1986
    • My PWS at Leuven Belgium Europe
Re: Switched Server Provider Now Fatal Error
« Reply #6 on: September 12, 2017, 05:00:03 PM »
It seems essential parts of PHP are not installed / available by your provider.

This is the official Saratoga test script
http://www.pennlake.us/check-fetch-times.php?show=info
which shows missing essential items which all providers normally supply:
function json_decode is NOT available
Without json support no data can be retrieved from NOAA/NWS, no data for earthquakes, no data for the Steelseries a.s.o.

Current GD status:
GD support: NO

GD support is essential for a lot of images which are dynamically created.

===
The versions of the Saratoga scripts are current, no problem there
http://www.pennlake.us/check-fetch-times.php?show=versions

===
The missing DOMDocument class form your first post is also not found for the same reasons.
This is from the PHP manual:  http://php.net/manual/en/intro.dom.php
Quote
The DOM extension allows you to operate on XML documents through the DOM API with PHP.
This is from the  http://php.net/manual/en/dom.installation.php
Quote
This extension is enabled by default. It may be disabled by using the following option at compile time: --disable-dom

So your provider choose to disable all DOM functions from the PHP 7.1 version you are using.

You should check with your provider why your php version is missing essential parts which your scripts need.  All Saratoga (and Leuven) template users need and have these extensions.

Wim
« Last Edit: September 12, 2017, 05:12:13 PM by wvdkuil »

Offline yamiacaveman

  • Forecaster
  • *****
  • Posts: 439
    • Penn Lake Weather
Re: Switched Server Provider Now Fatal Error
« Reply #7 on: September 12, 2017, 06:42:16 PM »
Thanks Wim van der kuil,

I sent my provider what you wrote, waiting for a response.

Thanks!!!!!!!!!!

Offline yamiacaveman

  • Forecaster
  • *****
  • Posts: 439
    • Penn Lake Weather
Re: Switched Server Provider Now Fatal Error Solved
« Reply #8 on: September 12, 2017, 06:47:23 PM »
Again thanks!!!!!!!! It was corrected within seconds after I sent your recommendations.

Thanks to all!!!!