I try to follow the instruction on https://www.domoticz.com/wiki/Extractin ... s_with_PHP
I created a php file in domoticz/scripts called extract.php.
When i try to execute in putty with ./extract.php i get the result "Permission denied".
My final goal is to export my data to a mysql database and (try to implement LUA Pass2php from Egregius), but the first step is that php is working.
Somebody a suggestion what i am doing wrong?
PHP: Functions to control Domoticz
Moderator: leecollings
-
- Posts: 55
- Joined: Saturday 05 March 2016 21:42
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.5629
- Contact:
PHP: Functions to control Domoticz
Rp3, youlesss, rfxcom, philips hue, dsb1820
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: PHP: Functions to control Domoticz
Did you disable authentication for 127.0.0.1 under settings, local networks?
Is the error from bash, php or domoticz?
Is the error from bash, php or domoticz?
-
- Posts: 55
- Joined: Saturday 05 March 2016 21:42
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.5629
- Contact:
Re: PHP: Functions to control Domoticz
Thanks for your reply Egregius.
1) Under settings, local networks I added "127.0.*,192.168.1.*"
2) The error is in bash, btw.
3) i executed chmod 775 extract.php (in bash)
4) when i execute now:
pi@raspberrypi ~/domoticz/scripts $ ./extract.php
I get the result...
./extract.php: line 1: ?php: No such file or directory
./extract.php: line 2: syntax error near unexpected token `('
./extract.php: line 2: ` $json_string = file_get_contents("http://192.168.1.xx:8080/json.htm?type=devices&rid=73");'
5) Is it required to install special php software (which is not mentioned in https://www.domoticz.com/wiki/Extractin ... s_with_PHP )
file extract.php contains...
=================================
<?php
$json_string = file_get_contents("http://192.168.1.xx:8080/json.htm?type=devices$
$parsed_json = json_decode($json_string, true);
$test_link = "/home/pi/domoticz/scripts/test_1.txt";
$test_data = fopen ($test_link, "w+");
fwrite ($test_data, print_R($parsed_json, TRUE));
fclose ($test_data);
?>
=================================
1) Under settings, local networks I added "127.0.*,192.168.1.*"
2) The error is in bash, btw.
3) i executed chmod 775 extract.php (in bash)
4) when i execute now:
pi@raspberrypi ~/domoticz/scripts $ ./extract.php
I get the result...
./extract.php: line 1: ?php: No such file or directory
./extract.php: line 2: syntax error near unexpected token `('
./extract.php: line 2: ` $json_string = file_get_contents("http://192.168.1.xx:8080/json.htm?type=devices&rid=73");'
5) Is it required to install special php software (which is not mentioned in https://www.domoticz.com/wiki/Extractin ... s_with_PHP )
file extract.php contains...
=================================
<?php
$json_string = file_get_contents("http://192.168.1.xx:8080/json.htm?type=devices$
$parsed_json = json_decode($json_string, true);
$test_link = "/home/pi/domoticz/scripts/test_1.txt";
$test_data = fopen ($test_link, "w+");
fwrite ($test_data, print_R($parsed_json, TRUE));
fclose ($test_data);
?>
=================================
Rp3, youlesss, rfxcom, philips hue, dsb1820
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: PHP: Functions to control Domoticz
Do you have php7-cli installed?
-
- Posts: 55
- Joined: Saturday 05 March 2016 21:42
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.5629
- Contact:
Re: PHP: Functions to control Domoticz
Hi Egregius. Took some time before i got into it.
Yes i have installed php7-cli. When i go to http://192.168.1.85/ the php info page is displayed. This is on port 80
Domoticz is running on port 8080. Do i have to enable php on 8080 as well in order to function (or shoudl i move domoticz to 80)?
Yes i have installed php7-cli. When i go to http://192.168.1.85/ the php info page is displayed. This is on port 80
Domoticz is running on port 8080. Do i have to enable php on 8080 as well in order to function (or shoudl i move domoticz to 80)?
Rp3, youlesss, rfxcom, philips hue, dsb1820
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: PHP: Functions to control Domoticz
You can't use the same port. One port for domoticz and one for the php webserver.
Who is online
Users browsing this forum: No registered users and 1 guest