element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Pi Chef Design Challenge
  • Challenges & Projects
  • Design Challenges
  • Pi Chef Design Challenge
  • More
  • Cancel
Pi Chef Design Challenge
Blog PiChef - SafeDegree Blog #4
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: mark.gitsham
  • Date Created: 28 Feb 2018 12:53 PM Date Created
  • Views 327 views
  • Likes 5 likes
  • Comments 1 comment
Related
Recommended

PiChef - SafeDegree Blog #4

mark.gitsham
mark.gitsham
28 Feb 2018

Goals for this Blog

Continuing on from my last blog, this time I will be installing and configuring the web server and database. For these, I have decided on using lighttpd for the web server and SQLite3 for the database. The reasoning behind using these two packages, are they are both lightweight and use very little system resources. This is something I learned back with Pi1’s… Originally I was a Apache and MySQL fan, but struggled to keep these running on the Pi1 and then changed over. That leads to my second reason to why I chose lighted and SQLite3 - I am comfortable in using and configuring them and they are reliable.

 

Web Server - lighttpd

Installing the basic web server is quite easy.

$ sudo apt-get update

$ sudo apt-get install lighttpd

 

And that’s it - if you want to load your static webpage in /var/www/html/ directory it will be available through your web browser at http://192.168.100.20

 

Now to make it more usable, I will install php7 this will allow server side scripting which also allows for access to database stored data.

$ sudo apt-get install php7.0-fpm php7.0-cgi

 

NOTE: I don’t run the following apt-get install php7.0 as by default will also install apache2 and not the two actually required packages for lighttpd.

 

Now, to enable php7, you have to enable the modules in the lighttpd configuration.

$ cd /etc/lighttpd

$ sudo cp conf-available/10-fastcgi.conf conf-enabled/

$ sudo cp conf-available/15-fastcgi-php.conf conf-enabled/

 

Restart the lighttpd web server

$sudo systemctl restart lighttpd

 

To test that everything is working so far, we can create a php info file in the default directory and check it out in our web browser.

$ cd /var/www/html

$ sudo vim

 

Placing the following in that file

<?php

phpinfo();

?>

 

Save it as phptest.php

 

On your browser, go to

http://192.168.100.20/testphp.php

And you should get a whole bunch of stuff about your system and php.

 

Database Server - SQLite3

Following on from the web server installation, we can now move onto install the database server.

$ sudo apt-get install sqlite3 php7.0-sqlite3

 

This will install both the SQLite3 server and the required packages to link SQLite3 to PHP7

 

And that is it, you can test the database installation by running

$ sqlite3 testdb.sqlite

That will put you into the SQLite3 CLI and create a blank database file.

Type .exit (noting the . ) to exit the CLI

 

Again, you will ned to restart the web server to enable the newly install php7.0-sqlite3 package and I will go through the web design and creation of the database in a later blog.

 

Conclusion

That wraps up the basic software installation for the SafeDegree Controller. It still leaves it as a pretty ‘dumb’ controller at this stage, but in later blogs, it will all start to come together.

 

For my next blog, I will begin working on the software side of the SafeDegree temperature sensor module.

  • Sign in to reply
  • genebren
    genebren over 7 years ago

    Nice update blog.  Keep up the good work.

    Gene

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube