<<<Rasberry Pi Guides>>>

Enable HTML Server

The reason I bought my Rasberry PI was to use it as a weather station, initially I only used a Davis Vantage Vue Weather Station but I have recently extended that with an Ecowitt GW1000 WiFi Weather Station Gateway and Ecowitt WH32 Outdoor Temperature and Humidity Sensor which I use to measure the temperature and humity in my caravan

This has left me with the challenge of how to merge the 2 data sets. Luckily the Ecowitt has the ability to POST data to an HTML server and this required me to work out how to do that

Turns out it is quite simple, although I did have some frustrations before I realised that I also had to install the php server, following are the steps I followed

Install Apache2

pi@raspberrypi:~ $ sudo su -
root@weewx:~# apt-get install apache2
Reading package lists... Done
Building dependency tree
Reading state information... Done

The following NEW packages will be installed:
apache2 apache2-bin apache2-data apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap
0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,969 kB of archives.
After this operation, 6,164 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
  

Install php

This was the bit I forgot the first time around

pi@raspberrypi:~ $ sudo su -
root@weewx:~# apt-get install php
Reading package lists... Done
Building dependency tree
Reading state information... Done

The following NEW packages will be installed:
libapache2-mod-php7.3 php php-common php7.3 php7.3-cli php7.3-common php7.3-json php7.3-opcache php7.3-readline
0 upgraded, 9 newly installed, 0 to remove and 0 not upgraded.
Need to get 2,974 kB of archives.
After this operation, 14.0 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
    

And it is as simple as that

Testing that it works

It is always nice to know that these things are working properly before moving on, and it is a simple task to test this process, simply create a file in the default directory /var/www/html and access it from a web browser

pi@raspberrypi:~ $ sudo su -
root@weewx:~# vi /var/www/html/mike.php
<?php
echo "hello world on ";
echo date('Y-m-d H:i:s');
phpinfo();
?>
    

Then launch your favourite web browser and conect to your Rasberry PI, for me this is http://172.16.47.11/mike.php

PHP Data