Looks OK now.
I created timeseries directory as that didn’t appear to be present on the local server.
Then sudo chown www-data:root /var/lib/timeseries
This is what I get when I run the php script but with sudo:
sudo php backup.php
{"id":"842586","nodeid":"1","name":"RP1","description":"Real Power","processList":"1:186321,4:186328","time":1528882719,"value":268}
{"id":"842614","nodeid":"1","name":"P1","description":"Apparent Power","processList":"1:186322","time":1528882719,"value":292.99}
{"id":"842628","nodeid":"1","name":"C1","description":"Current","processList":"1:186324","time":1528882719,"value":1.23}
{"id":"842629","nodeid":"1","name":"T1","description":"Temperature","processList":"1:186323","time":1528882719,"value":30.4}
{"id":"889497","nodeid":"1","name":"PF1","description":"Power Factor","processList":"1:187284","time":1528882719,"value":0.91}
{"id":"889521","nodeid":"1","name":"V1","description":"Supply Voltage","processList":"1:187288","time":1528882719,"value":238.2}
{"id":"925979","nodeid":"1","name":"E1","description":"Energy WH","processList":"1:188128","time":1528882719,"value":1926859}
8 Emoncms.org feeds found
PHPFINA: 186321
--downloaded: 3063280 bytes
PHPFINA: 186322
--downloaded: 3063264 bytes
PHPFINA: 186323
--downloaded: 3063228 bytes
PHPFINA: 186324
--downloaded: 3063220 bytes
PHPFINA: 186328
--downloaded: 3062836 bytes
PHPFINA: 187284
--downloaded: 8903436 bytes
PHPFINA: 187288
--downloaded: 8903312 bytes
PHPFINA: 188128
--downloaded: 8677452 bytes
Wouldn’t import the data without sudo but then the files that have been downloaded need to be changed from root owner to www-data owner with:
sudo chown www-data:root /var/lib/phpfina/*.*