-
Notifications
You must be signed in to change notification settings - Fork 7
Setup Web Server and MySQL Database
Mario Frei edited this page Jul 17, 2020
·
3 revisions
We recommend using a web hosting service. However, for testing purposes, a web server on a local computer could be used as well.
- XAMPP is an open-source cross-platform web server solution.
- Download XAMPP from https://www.apachefriends.org/index.html
- Install XAMPP.
- Start XAMPP.
- In the XAMPP control panel, start the Apache module and MySQL module
- Test web server
- Open a web browser and go to 127.0.0.1
- You should see a welcome page of the XAMPP web server
- To access your local web server from outside your local LAN, the port forwarding on your router needs to be reconfigured.
- Import database files
- Go to 127.0.0.1/phpmyadmin
- In the left-hand side panel click on «New»
- Enter «ddr» as the database name.
- Click «Create»
- Go to «Import»
- Choose «Web_Server\MySQL\database_structure_v1.sql» from the repository.
- Leave all other settings as they are.
- Click «Go» on the bottom of the page
- Now, you should be able to see the tables of the database in the left-hand side panel. They are named «wsn_input», «wsn_input_raw», «wsn_measurement_campaign», and «wsn_sensor_module_type».
- Add a user account to MySQL database
- In the left-hand side panel, click on the «ddr» database
- Go to «Privileges»
- Click to «Add user account» on the bottom.
- Add «wsn_user» as username.
- Add «localhost» as hostname
- Type a password of your choosing.
- Re-type your password
- Check the «Data» in the «Privileges» section.
- On the very bottom, click on «Go»
- Prime database
- Before you are able to receive data and log it into the database, the «wsn_sensor_module_type» table needs to be populated. A sample table is available under «Web_Server\MySQL\database\wsn_sensor_module_type_data.sql». Alternatively, you can create your own sensor module type definitions.
- Within the phpMyAdmin interface, the above sql-file can imported:
- Go to the phpMyAdmin interface
- Select the «wsn_sensor_module_type» table
- Go to the «Import» tab
- Under «File to import» select the file «Web_Server\MySQL\database\wsn_sensor_module_type_data.sql» from the repository and click «Go» at the bottom
- Install PHP scripts
- Create a new folder called "wsn" in the directory "C:\xampp\htdocs"
- Copy the content from «Web_Server\PHP» from the repository to "C:\xampp\htdocs\wsn"
- Open the script «C:\xampp\htdocs\wsn\config.php» in a text editor.
- Add the name of the database. ($db_name = '' '';)
- Add the password for the database user ($db_password = '' '';)
- Add the an e-mail address of the admin ($e_mail_address_admin = "";)
- Go to «http://127.0.0.1/vis/isituprightnow\_v4.php»
- You should now see a table, with red cells. This means that the web server setup is working. However, there is no recent data in the database.