pihome-shc / pihome

PiHome - Smart Heating, Ventilation and Air Conditioning (HVAC)
http://www.pihome.eu
Other
52 stars 25 forks source link

Web Server Issue #406

Open aszumski opened 3 years ago

aszumski commented 3 years ago

Hi, I have web server issue after last update. When I connect to the pihome web I can see login screen but then when I hit login I get HTTP error 500. Then if I try to reload I 'm getting HTTP error 500. If I clear cache I can get to the login page, but then I get same problem.

Initially it happened on my wife's mobile, now it's the same on mine. Trying different browsers etc.

It only works on my PC now.

Anyone have any idea how to debug it?

pihome-shc commented 3 years ago

@aszumski i have seen this issue, with one customer but for me quick fix was to export database and copy img file and import database this user was on remote location so i couldn't do much troubleshooting. and there wasnt anything in logs either.

aszumski commented 3 years ago

@pihome-shc it's very strange, If i roll back to release 1.75 it loads home.php OK of course this release is not compatible with my current database. i have same issue with 1.76 as with the latest code.

aszumski commented 3 years ago

restored latest image and I have the same issue. after dhcp changed IP for PI it doesn't even work with my PC.

can you guys try to close all tabs in your browser clear cache and see if you have issue. I suspect I had something cached in the browser to allow me to connect OK.

aszumski commented 3 years ago

After restoring 1.77 image restoring database and upgrading system in phpmyadmin I get :

`1: Warning in ./libraries/sql.lib.php#613 count(): Parameter must be an array or an object that implements Countable

Backtrace

./libraries/sql.lib.php#2128: PMA_isRememberSortingOrder(array) ./libraries/sql.lib.php#2062: PMA_executeQueryAndGetQueryResponse`

But everything seems to work OK, Seems like some bug between database/phpmyadmin.

After trying to get some logs from apache, Restoring 1.77 image and and my database, having trouble gateway connecting back (I use my pi as wireless AP for gateway)

Restarting unmanaged switch that pihome was connected to, fixed the original issue, don't ask me how.

pihome-shc commented 3 years ago

@aszumski, i think i have pin pointed this issue now, i have same issue and its even worst for me, after re-writing img to sd card and restoring database it wouldnt open web page for me, only login page and after that nothing black screen on mobile and on computer browser error 500 in session.php file if i comment out following code then it start to work and then uncomment is and still working, may be the way we set cookies some browser dont like it. perhaps we have to investigate this issue in more details.

can you re-open this issue

//Set Cookies for PiHome Lanauge 
if(isset($_COOKIE['PiHomeLanguage'])){
    require_once "languages/".$_COOKIE['PiHomeLanguage'].".php";
} else {
    require_once('languages/en.php');
}
aszumski commented 3 years ago

Got same issue when I comment this code it's working OK (but graphics are little bit misplaced). When I uncomment I get issue again. So I just left require_once('languages/en.php'); Uncommented and it works fine. I'm just thinking language is set wrong in the Cookie for some reason. Should we also check if file exists and is readable is_readable(languages/".$_COOKIE['PiHomeLanguage'].".php") exists in the if statement.