Code: Select all
Notice: Undefined variable: db in /var/www/html/secure/_fetchdomoticz.php on line 85
That's your error

Open _fetchdomoticz in a editor to search for that line.
And some tips about debugging:
About undefined variable:
Look up the line with the error, select the variable $db and search for it in the file.
You will not find it. That's because I run _fetchdomoticz included from my floorplan. So it gets included in ajax.php.
If you don't want to use the floorplan you need to include functions.php in _fetchdomoticz.php:
In functions.php you'll see "require '/var/www/config.php';". That's a config file stored outside the www root with all your personal variables. There's an example file in the secure folder. Copy it to /var/www and edit as needed.
Just noticed that in the example config the db variables are missing, you can add them:
Code: Select all
$dbname='domotica';
$dbuser='domotica';
$dbpass='fount-bonn-Subside-7protegee-7Howl-jerk-nerd8-8courier-aftermost-eldest7-Devon-9Sect-catnap-Evans-8hypnotic';
Another tip while programming, choose one of them:
A) Have 2 SSH windows open to your domoticz server. In one you have a tail to the domoticz file, in another you have tail open for the php error file.
Code: Select all
tail -f -s 0.5 -n 1000 /var/log/domoticz.log
tail -f -s 0.5 -n 1000 /var/log/apache2/phperror.log
B) Install multitail. with multitail you can watch several logfiles at once with color coding.
Code: Select all
multitail -cS domo_log /var/log/domoticz.log -I /temp/ajax.log -I /var/log/apache2/phperror.log
Another tip for using a shell window:
Add some aliases to your .profile file.
When just connected you're in your users home folder. There type nano .profile and add these lines at the end of the file:
Code: Select all
alias q="exit"
alias ll="ls -lsha"
alias upd="apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y"
alias reload_profile=". ~/.profile"
alias xxa="service apache2 restart && service php7.3-fpm restart"
alias error="tail -f -s 0.5 -n 1000 /var/log/apache2/phperror.log"
alias domo="tail -f -s 0.5 -n 1000 /var/log/domoticz.log"
alias ajax="tail -f -s 0.5 -n 1000 /temp/ajax.log"
alias log="multitail -cS domo_log /var/log/domoticz.log -I /temp/ajax.log -I /var/log/apache2/phperror.log"
alias access="multitail -cS access_log /var/log/apache2/access.log"
The next time you'll connect to the shell you can use the shortcuts.
This is my config for multitail, stored in ~/.multitailrc
Code: Select all
colorscheme:domo_log
cs_re:green:.*\(STOREMODE\).*
cs_re:green:.*\(STOREICON\).*
cs_re:green:.*\(STORE\).*
cs_re:yellow,blue,bold:.*\(AJAX\).*
cs_re:white,blue,bold:.*\(SWITCH\).*
cs_re:white,red:.*\(SETLEVEL\).*
cs_re:yellow:.*\(Xiaomi\).*
cs_re:yellow:.*\(ZWAVE\).*
colorscheme:access_log
cs_re:yellow:.*ajax.php.*
cs_re:green:.*smappeepower.php.*
cs_re:green:.*cron.php.*
cs_re:green:.*pass2php.php.*
And finally: try to read as much possible of the code so you'll learn to understand how and what's done in it.