Git Product home page Git Product logo

simple-lamp's Introduction

Simple LAMP Web Application

If you are using Ubuntu 16.04, the software installation part is a little bit different:

$ sudo apt-get update
$ sudo apt-get install git mysql-server
$ sudo apt-get install apache2 php libapache2-mod-php php-mcrypt php-mysql php-curl php-xml php-memcached
$ sudo service apache2 restart

Then we clone the source code from git repository. Here we assume that you are using "ubuntu:ubuntu" as the Linux username and group name.

$ cd /var
$ sudo chown -R ubuntu:ubuntu www
$ cd /var/www/html
$ git clone https://github.com/qyjohn/simple-lamp

Then we create a MySQL database and a MySQL user for our demo. Here we use “simple_lamp” as the database name, and “username” as the MySQL user.

$ mysql -u root -p
mysql> CREATE DATABASE simple_lamp;
mysql> CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
mysql> GRANT ALL PRIVILEGES ON simple_lamp.* TO 'username'@'localhost';
mysql> quit

In the code you clone from Github, we have pre-populated some demo data as examples. We use the following command to import the demo data in web_demo.sql to the web_demo database:

$ cd /var/www/html/simple-lamp
$ mysql -u username -p simple_lamp < simple_lamp.sql

Before we can make it work, there are some minor modifications needed:

(1) Use a text editor to open config.php, then change the username and password for your MySQL installation.

(2) Change the ownership of folder “uploads” to “www-data” so that Apache can upload files to this folder.

$cd /var/www/html/simple-lamp
$ sudo chown -R www-data:www-data uploads

In your browser, browse to http://ip-address/simple-lamp/index.php. You should see that our application is now working.

To enable session sharing using MemCached, edit /etc/php5/apache2/php.ini (Ubuntu 14.04) or /etc/php/7.0/apache2/php.ini (Ubuntu 16.04), with the following modifications:

session.save_handler = memcached
session.save_path = "dns-or-ip-of-memcached-server:11211"

Then you need to restart Apache on both web servers to make the new configuration effective.

$ sudo service apache2 restart

To enable front page caching using MemCached, edit config.php and update the following line:

// Cache configuration
$enable_cache = true;
$cache_server = "dns-or-ip-of-memcached-server";

simple-lamp's People

Contributors

ronyblum avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.