Author Topic: php include no longer working  (Read 1070 times)

0 Members and 1 Guest are viewing this topic.

Offline Bashy

  • brecklandweather.com/meteo
  • Forecaster
  • *****
  • Posts: 1465
  • brecklandweather.com/index.php
    • Breckland Weather
php include no longer working
« on: November 30, 2018, 12:26:17 AM »
Hi folks, my apache updated automatically a short while back and since then my php include does not work,

Code: [Select]
<?php include("http://www.suffolkweather.info/metoforecast-today-xml.php"); ?>
It breaks the rest of the page, has something changed please? the link in the code works fine, you can see what its doing to my page here, thanks...
Kind regards
Bashy

Online Jasiu

  • Forecaster
  • *****
  • Posts: 949
    • LexMAWeather
Re: php include no longer working
« Reply #1 on: November 30, 2018, 09:16:32 AM »
Hi Bashy,

How did you determine that include file is causing the problem?

I'll note that the Firefox web console says a piece of javascript isn't loading:

Quote
Loading failed for the <script> with source “http://www.suffolkweather.info/ajaxWDwx0.js”. www.suffolkweather.info:433:1
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Offline Bashy

  • brecklandweather.com/meteo
  • Forecaster
  • *****
  • Posts: 1465
  • brecklandweather.com/index.php
    • Breckland Weather
Re: php include no longer working
« Reply #2 on: November 30, 2018, 09:29:38 AM »
Hi, thanks  for the reply, Yeah, its deffo sommat to do with the include cause as soon as i turn off that block, the page loads fine, i have enabled that .js again but i am sure i turned it off for a reason as it was labled, NOTUSED lol

I am at a loss at the moment, cause its the same on all 3 templates im using, although, the other 2 templates are using the same include from suffolkweather, so they would be down to if that one is, hence i only mentioned suffolkweather, its deffo turned on in the php.ini too, i think the php version changed as well as the apache, i have backtracked the php versions rebuilt with nearly all extentions too, i am baffled at present  :-(
« Last Edit: November 30, 2018, 09:31:30 AM by Bashy »
Kind regards
Bashy

Offline Bashy

  • brecklandweather.com/meteo
  • Forecaster
  • *****
  • Posts: 1465
  • brecklandweather.com/index.php
    • Breckland Weather
Re: php include no longer working
« Reply #3 on: November 30, 2018, 09:32:46 AM »
ps, i have also tried the include like this too to no avail (changed " for ' and removed the ()

Code: [Select]
<?php include 'http://www.suffolkweather.info/metoforecast-today-xml.php' ?>
Kind regards
Bashy

Online Jasiu

  • Forecaster
  • *****
  • Posts: 949
    • LexMAWeather
Re: php include no longer working
« Reply #4 on: November 30, 2018, 09:53:53 AM »
Something else I noticed using check-fetch-times.php:

Code: [Select]
--checking WU Forecast URL --
URL: http://www.wunderground.com/cgi-bin/findweather/getForecast?query=brandon
GET /cgi-bin/findweather/getForecast?query=brandon HTTP/1.1
      Host: www.wunderground.com  Port: 80 IP=23.62.204.134
HTTP stats: dns=0.001 conn=0.009 put=0.000 get(20 blocks)=0.013 close=0.000 total=0.023 secs
fetch function elapsed= 0 secs.
RC=301 Moved Permanently, bytes=757
------------
Headers returned:

HTTP/1.1 301 Moved Permanently
Server: AkamaiGHost
Content-Length: 0
Location: https://www.wunderground.com/cgi-bin/findweather/getForecast?query=brandon
Cache-Control: max-age=0
Expires: Fri, 30 Nov 2018 14:51:34 GMT
Date: Fri, 30 Nov 2018 14:51:34 GMT
Connection: close
Set-Cookie: speedpin=4G; expires=Fri, 30-Nov-2018 15:21:34 GMT; path=/; domain=.wunderground.com; secure
Set-Cookie: ci=TWC-Locale-Group=US&X-Origin-Hint=dna&TWC-GeoIP-Country=FR&TWC-Privacy=gdpr; path=/; domain=.wunderground.com
Property-id: drupal-prod
X-RequestSource: AkamaiProdProxy
TWC-Privacy: gdpr
TWC-GeoIP-LatLong: 48.87,2.33
TWC-GeoIP-Country: FR
TWC-Device-Class: desktop
TWC-Locale-Group: US
TWC-Connection-Speed: 4G
X-RequestSource: AkamaiDefaultDN
------------
--end WU Forecast URL check --


Should change that "http" to https".

Will continue to look at this as I can. Ken will probably know off the top of his head though.

https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Offline Bashy

  • brecklandweather.com/meteo
  • Forecaster
  • *****
  • Posts: 1465
  • brecklandweather.com/index.php
    • Breckland Weather
Re: php include no longer working
« Reply #5 on: November 30, 2018, 09:58:08 AM »
Thanks, I will sort that when back at the computer. It is probably something very simple, the actual page to include works great, it's the exact same with the full version (month forecast) I've not mentioned that caus eif one is resolved then I will know how to do the other lol
Kind regards
Bashy

Online Jasiu

  • Forecaster
  • *****
  • Posts: 949
    • LexMAWeather
Re: php include no longer working
« Reply #6 on: November 30, 2018, 10:05:13 AM »
I'm not able to check the versions of the files you have because check-fetch-times.php is over 10 years old!

Quote
check-fetch-times.php Version 1.02 - 19-Sep-2008

Current version is 1.23 from March of this year.
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Offline Bashy

  • brecklandweather.com/meteo
  • Forecaster
  • *****
  • Posts: 1465
  • brecklandweather.com/index.php
    • Breckland Weather
Re: php include no longer working
« Reply #7 on: November 30, 2018, 10:56:32 AM »
Yes, sounds about right as its a dead site, nothing is updated.
Kind regards
Bashy

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9277
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: php include no longer working
« Reply #8 on: November 30, 2018, 11:02:02 AM »
I agree with Jaisu.. you need a serious update to the site and a current version of check-fetch-times.php would be a great start.

For your issue with
Code: [Select]
<?php include("http://www.suffolkweather.info/metoforecast-today-xml.php"); ?> there's two things:
1) it's not a good idea to include() from a http/https .. it could be a path for remote code execution.

2) that behavior by PHP is controlled in php.ini with the allow_url_include option.  By default, and for safety, it's usually set to off.

Since the page you're including is only HTML, you can use the safer construct to read/print the page instead:

Code: [Select]
<?php readfile("http://www.suffolkweather.info/metoforecast-today-xml.php"); ?> which will simply grab the contents of the URL and print it in the page with no PHP script parsing (such as is done with include()).
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Bashy

  • brecklandweather.com/meteo
  • Forecaster
  • *****
  • Posts: 1465
  • brecklandweather.com/index.php
    • Breckland Weather
Re: php include no longer working
« Reply #9 on: November 30, 2018, 11:15:52 AM »
Thats brill, didnt know about the read file, thanks Ken, that site is no longer in use Ken but i need it there for cross site reasons until i can fully migrate it over. I keep doing little bits at a time but i cannot sit too long cause of my back, so when i come back to it, i have generally forgot how far i got to and spend about 10 minutes trying to remember, i will get there, slowly, thanks again for the fix :)
« Last Edit: November 30, 2018, 11:51:52 AM by Bashy »
Kind regards
Bashy

Offline Bashy

  • brecklandweather.com/meteo
  • Forecaster
  • *****
  • Posts: 1465
  • brecklandweather.com/index.php
    • Breckland Weather
Re: php include no longer working
« Reply #10 on: November 30, 2018, 12:03:28 PM »
Interestingly Ken, i do have the allow_url_include option enabled in php.ini

This is site thats live, not been updated in a long time either, i normally just let them run until something rears its ugly head like today :/

Looks like the php aint working for the wxsim of which should be showing here its actually this script of which also has an unrelated issue lol, not looked it that yet as i have only just noticed it :(
Kind regards
Bashy