SEEM4540 Open Systems for E-Commerce Lecture 04 Servers Setup and Content Management Systems
Prolog To show our e-commerce store, we need to have a web server. There are three ways to obtain a web server: Pay a hosting company which setup everything for you. Buy a server-grade computer, rent an IP address and set up everything by yourself. Hybrid: pay a hosting company for the hardware and IP, you set up yourself. What are the pros and cons of the above approaches?
More About Web Server Note: Web servers are not always used for serving the Internet. They can also be found in devices such as printers, routers, webcams (serving only a local network) The web server may then be used as a part of a system for monitoring and/or administering the device in question. This usually means that no additional software has to be installed on the client computer, since only a web browser is required.
Find a Hosting Company Two types of hosting companies: Paid E.g. GoDaddy, NameCheap, etc. Free E.g. http://www.free-webhosts.com/ A real story: I put every thing on a free hosting company The company suddenly disappeared one day when I woke up Everything is gone No way to complain...
Find a Hosting Company (cont'd) When choosing a hosting company, some general question you need to ask (at least): What kind of programming language you want? (PHP? JSP?) How to upload file to the web server? What is the operating system? (Windows? Linux?) What is the DBMS? (MySQL? Oracle?) What kind of web server it is using? (Apache? Microsoft IIS?) What is the maximum single file size for upload/download? What is the maximum total bandwidth? What is the speed? How much memory your are allowed to use?
Find a Hosting Company (cont'd) Where is the server? Some countries may block some servers in some locations The reputation of the server? This is extremely useful for sending and receiving emails. Most hosting companies also provides email services, i.e., they have set up both web servers and email servers. You may not send email out successfully if the email server has bad reputation!
Setup a Web Server In case you want to set up your own web server, there are many web servers. Two most popular: Apache HTTP Server Nginx http://httpd.apache.org/ http://nginx.org/ You can install the above Web Servers in most of the common operating systems, such as Windows, Linux, Mac.
Setup a Web Server (cont'd) By default, web server does not know programming, i.e. it cannot do any server side programming, such as connecting to a database system, allowing user login/logout, reading PHP, JSP, ASP, etc. So we need to install modules to let the web server understand different programming languages. Note: Install PHP module then the web server understand PHP programs Install JSP module then the web server understand JSP programs If you want to write ASP programs, you must install Microsoft IIS Server. There is no ASP module for Apache or Nginx.
XAMPP Instead of installing the a web server, the PHP module and a DBMS one by one, there is an extremely handy package called XAMPP that can do everything for you with just one click: https://www.apachefriends.org/index.html After your servers are up, you are now ready to build your web store!
Content Management Systems (CMS) Allows publishing, editing and modifying content, organizing, deleting as well as maintenance from a central interface. Available since the late 1990s. Provides procedures to manage workflow in a collaborative environment. Allows a content creator to use an editor to create and edit content with an authorized user to approve the content to be published in a live environment. All of this interaction is controlled through security, workflow and audit trails and all of this is stored and tracked in a database.
Why Need a CMS? Short answer: this is a tough question The truth is, you need to feel the pain of a static website before you can fully understand and appreciate the advantages of a CMS-driven solution... Without a CMS If you have just some very basic tools to maintain your site. This usually works well when the site is small. But over time as the amount of content increases, the challenges of maintaining it also increase. What used to take just one person to manage now takes many.
Why Need a CMS? (cont d) In the past, an organization usually will have a group of people (without IT background) responsible for writing the content, i.e. content creator. The content creator needs to send the content to the web developer to implement. This is inefficient. A better approach: there is a tool for the the content creator to write the content directly without seeking the help from the web developer.
Why Need a CMS? (cont d) In addition, as more and more pages are added to the website, it often becomes necessary to create new layouts and arrangements to accommodate the new content. Changes to the layout and appearance of the website often mean that a programmer will need to be involved in the creation of these new pages and layouts. In the end, the website is comprised of numerous page templates, countless pages of content, and multiple content authors with no real system to manage everything.
Benefit of CMS CMS makes your website easier to use, less expensive to maintain, and more secure: 1. Allows content to be controlled by the people who own the content. No more relying on developers to make changes to the web content. We can add content without knowing HTML or any code. This saves money and time. 2. Content can be added to the site much more quickly and efficiently. Nothing is worse than time-sensitive information not getting posted in time because the web developer are too busy to post the updated content!
Benefit of CMS (cont d) 3. Keeping content controlled by the content authors frees up the developers time to focus on other things (like the design of the front end of the website or implementation of new features and functionality). 4. Allows you to distribute content authoring duties to different people within your organization. Many good CMSs allow you to set up approval chains and permissions. This helps to make sure that content doesn t appear on the website unless it has been fully approved. 5. Workflows are built-in as part of the CMS. This gives people the ability to view, share, and approve drafts of content without needing to refer to any printouts or emails. Everything is self-contained within the CMS.
List of CMSs There are numerous of CMS exists! E.g., see: http://en.wikipedia.org/wiki/list_of_content_management_sys tems
Choosing CMS Secure When the CMS has its last security review or latest version? Multilingual Can the CMS cater for different language both on the frontend and backend? Scalable architecture Can the software be load balanced across multiple web servers? Migration tools Does it come with tools or methods for migrating to different domains?
Choosing CMS (cont d) Documentation and Support Is it backed up with appropriate technical documentation? Web standards Can it produce clean, semantic HTML and accessible content? It is useful for SEO. Installers Does it have a simple 1 click installation, or is an army of engineers required to make it work? Usability Is it simple to use or it needs extensive training?
Choosing CMS (cont d) Extensible Does it have a mature API or SDK allowing it to be easily integrated or extended?
WordPress In this course, we will focus on WordPress. https://wordpress.org/ Why? Easy to use Extremely popular Have all of the previous properties Note: www.wordpress.org and www.wordpress.com are different!
Install WordPress Prerequisite: Web server: You must have a web server running PHP DBMS: For standard installation, you must have MySQL. In this course and in your project, we will use SQLite (a nonstandard installation. We will discuss why later).
Install WordPress with MySQL Steps: 1. Create a database for WordPress in MySQL 2. Download the latest WordPress installation package http://www.wordpress.org 3. Upload the WordPress files to your server 4. Go through the installation process
Install WordPress with SQLite Why SQLite? In some cases your web server does not have MySQL and it is impossible to install one for you. SEEM web server does not have MySQL. We will normally not install a MySQL database for you as well. What is SQLite? Technically, SQLite is simply one single file. You do not need to install anything. The only thing you need to have is that the programming module (e.g. PHP Module) support SQLite. SEEM web server PHP Module supports!
Install WordPress with SQLite (cont d) Download: WordPress: https://wordpress.org/download/ SQLite Plugin: https://wordpress.org/plugins/sqlite-integration/installation/ Follow the installation instruction in: https://wordpress.org/plugins/sqlite-integration/installation/ Note: You may skip everything from Optional settings Make sure the directory wp-content is writable! E.g., change the file mode to 0775 Copyright (c) 2015. Gabriel Fung. All rights reserved.
Install WordPress with SQLite (cont d) If you have errors during or after installation, you can try to apply a fix by yourself: https://wordpress.org/support/topic/too-many-open-files-toomany-pdo-connect Copyright (c) 2015. Gabriel Fung. All rights reserved.
Sample Screenshots
Sample Screenshots (cont d)
Sample Screenshots (cont d)
Sample Screenshots (cont d)
Sample Screenshots (cont d)
Sample Screenshots (cont d)
Sample Screenshots (cont d)
WordPress Loading Sequence Please refer to the following two links: http://codex.wordpress.org/template_hierarchy
More About DBMS We have many different DBMS! Some of the most famous ones: MySQL (open-source) SQLite (open-source) PostgreSQL (open-source) Oracle IBM DB2.
DBMS Relational Database Management Systems (DBMSs) implement the relational model to work with the data. Relational model shapes whatever information to be stored by defining them as related entities with attributes across tables (i.e. schemas). DMBSs require tables to be defined in order to work with data. With tables, each column holds a different data type of information. Each record in the database, uniquely identified with keys, translates to a row that belongs to a table, with each row s series of attributes being represented as the columns of a table all related together, as defined within the relational model. Copyright (c) 2015. Gabriel Fung. All rights reserved.
SQLite SQLite is a self-contained, file-based database. Advantages: File based: The entire database consists of a single file on the disk, which makes it extremely portable. Standards-aware: Most standard SQL features are implemented (except some features like RIGHT OUTER JOIN, FOR EACH). Very fast read operations Copyright (c) 2015. Gabriel Fung. All rights reserved.
SQLite (cont d) Disadvantages: No user management: SQLite does not have user management (E.g. there is no super user, normal user, etc. All users can only read and write the database without restriction). Lack of the possibility of performance tuning: SQLite is not possible to fine tune it performance Slow write operation It allows only one single write operating to take place at any given time, hence allowing a limited throughput. Copyright (c) 2015. Gabriel Fung. All rights reserved.
MySQL / MariaDB MySQL is one of the most popular large-scale DBMS. It is a feature rich, open-source product that powers a lot of web-sites and applications online. Getting started with MySQL is relatively easy and developers have access to a massive array of information regarding the database on the internet. In 2008, Sun Microsystem acquired MySQL. In 2009, the founder of MySQL, Michael Monty Widenius leads another DBMS called MariaDB. MariaDB has extremely high capability with MySQL Copyright (c) 2015. Gabriel Fung. All rights reserved.
Advantages of MySQL/MariaDB Distributed operations Excellent for client-server environment Feature rich, scalable and powerful Supports many SQL functionalities and can handle lots data. Third-party tools, including visual ones (i.e. GUIs) make it extremely simple to get started with the database. Secure and multi-user management: A lot of security features. Speedy: Giving up some standards so as to work very efficiently and cut corners, thus providing speed gains. Copyright (c) 2015. Gabriel Fung. All rights reserved.
Disadvantages of MySQL SQL compliance: MySQL does not implement the full SQL standard, this tool is not completely SQL compliant. Concurrency: Even though MySQL and some storage engines perform really well with read operations, concurrent read-writes can be problematic. Copyright (c) 2015. Gabriel Fung. All rights reserved.
PostgreSQL PostgreSQL is an advanced, open-source object-relational database management system which has the main goal of being standards-compliant and extensible. PostgreSQL tries to adopt the ANSI/ISO SQL standards together with the revisions. Copyright (c) 2015. Gabriel Fung. All rights reserved.
Advantages of PostgreSQL Distributed operations Excellent for client-server environment An open-source SQL standard compliant RDBMS: It fulfills all the four ACID properties. Strong community: Supported by an experienced community. Extensible: It is possible to extend PostgreSQL programmatically. Object-oriented: It supports nesting, etc. Copyright (c) 2015. Gabriel Fung. All rights reserved.
Disadvantages of PostgreSQL Performance: For read-heavy operations, PostgreSQL can be an over-kill and might appear less efficiency. Popularity: It lacks behind in terms of popularity, despite the very large amount of deployments - which might affect how easy it might be possible to get support. Hosting: It is harder to come by hosts or service providers that offer managed PostgreSQL instances. Copyright (c) 2015. Gabriel Fung. All rights reserved.
Choose the Right DBMS Some general considerations: Is the data separated from the application by a network? choose MariaDB/MySQL or PostgreSQL Many concurrent writers? choose MariaDB/MySQL Big data? choose MariaDB/MySQL or PostgreSQL Need strong community support especially related to web programming? choose MariaDB/MySQL Need 100% SQL standard compliance? choose PostgreSQL Need Object Oriented upport? choose PostgreSQL Otherwise choose SQLite! Copyright (c) 2015. Gabriel Fung. All rights reserved.
Visualize SQLite Download: https://code.google.com/p/phpliteadmin/ Installation: Rename phpliteadmin.sample.config to phpliteadmin.config Change the database location in phpliteadmin.config: Line 16: $directory = './../wp-content/database/'; Move both files to your web server Create a directory db and move both files there Access via http://www.xxxxxx/db/phpliteadmin.php Copyright (c) 2015. Gabriel Fung. All rights reserved.
Visualize the Database (cont d) Copyright (c) 2015. Gabriel Fung. All rights reserved.
Note In case you forgot your username and password of wordpress admin, you can modify the table wp_users directly. Change the file user_pass. Make sure you set the function to be md5. Copyright (c) 2015. Gabriel Fung. All rights reserved.
Other Popular CMS
References http://blog.wsol.com/why-choose-a-cms http://www.elcomcms.com/resources/articles/cmschecklist/cms-checklist https://www.digitalocean.com/community/tutorials/sqlite-vsmysql-vs-postgresql-a-comparison-of-relational-databasemanagement-systems https://www.digitalocean.com/community/tutorials/sqlite-vsmysql-vs-postgresql-a-comparison-of-relational-databasemanagement-systems https://www.sqlite.org/whentouse.html