pi-hole / web

Pi-hole Dashboard for stats and more
https://pi-hole.net
Other
2k stars 555 forks source link

Centos 7.5.1804 PHP error #746

Closed rrobgill closed 6 years ago

rrobgill commented 6 years ago

In raising this issue, I confirm the following:

How familiar are you with the the source code relevant to this issue?:

5

Expected behaviour:

Access to pi-hole admin page.

Actual behaviour:

500 error in browser. /var/log/lighttpd/error.log: (mod_fastcgi.c.434) FastCGI-stderr: PHP Fatal error: Can’t use function return value in write context in /var/www/html/pihole/index.php on line 105

Steps to reproduce:

Install pi-hole under these versions of Centos. Attempt to open admin page.

Debug token provided by uploading pihole -d log: Reported in discourse by sfraser sfraser's token wxfrw87gzf Replicated by me - my token : 0puvbj1805

Troubleshooting undertaken, and/or other relevant information:

As a quick and dirty fix, changing line 105 of /var/www/html/pihole/index.php from if (empty(glob("/etc/pihole/list.0..domains"))) to if ((glob("/etc/pihole/list.0..domains")) == "") allows the page to load.

I have not run extensive testing to see what other side-effects this could have, but the obvious one is that it may fall over in an ungraceful manner if the blocklists are not present, and it can't tell?

This is not a duplicate of #628 (the failure there occurred in a different location) but I suspect the two are related, as both involve calling empty(somefunction()) and failing in a similar manner.

Reported in discourse by sfraser

dschaper commented 6 years ago

https://github.com/pi-hole/pi-hole/issues/1955

I think this is the PHP 7 vs PHP 5 issue again.

rrobgill commented 6 years ago

Yes. That's the same issue. Didn't see that one when I went searching. Sorry.

dschaper commented 6 years ago

This is a better place to track it, didn't mean for this to close, just linking from the core.

bcambl commented 6 years ago

I have a PR open to address this with the installer here: https://github.com/pi-hole/pi-hole/pull/2161

You can try the following as a workaround until if/when my PR is approved and merged:

yum install -y https://rpms.remirepo.net/enterprise/remi-php72-$(rpm -E '%{rhel}').rpm
yum-config-manager --enable remi-php72

Edit: fixed repo url

rrobgill commented 6 years ago

@bcambl I can confirm that upgrading php via remi's 7.0 repo also works

rrobgill commented 6 years ago

The stop-gap fix has been merged, which will keep it working (for now) until people install new repos in bcambl's fix.