LAMP  ARCHITECTURE Linux-Apache-MySQL-PHP PRESENTED BY: ANURAG PANDEY NAKUL LOHRI SAMREEN JAMAL VINITA LALL
LAMP LAMP stands for Linux-Apache-MySQL-PHP. Instead of PHP, Perl and Python are also used. This is a free and lightweight alternative to “WISA,” Windows-IIS-SQL Server-ASP (and now, ASP.Net).
LAMP ARCHITECTURE
 
LAMP as FOSS Each of the components in the LAMP stack is an example of Free or Open Source Software Benefits of FOSS approach is three-fold 1. Free download  2. Open licenses and few restrictions 3. Easier to fix faults
 
Linux
Version of UNIX Linus Torvalds – Creator of Linux Open Source Operating System Free Software Source Code Available Programmer based culture Background on Linux Background on Linux
Linux vs. Windows Financial Differences Technical Differences
FINANCIAL DIFFERENCES COST LINUX WINDOWS Online Downloads Free Not Available Retail Price, CD $50 $300
Cost for Businesses Companies have to spend millions for licenses for ever individual windows computer For Linux companies don’t have to spend anything
TECHNICAL DIFFERENCES Keeping up to date By Upgrading Linux upgrades faster than Windows Compatibility Linux is Backward Compatible unlike  Windows
Apache
BACKGROUND OF APACHE Web Server Initially started in 1996 by Robert McCool.  Available for a wide variety of operating systems, including Unix, GNU,Linux, Solaris, Mac OS X, Microsoft Windows. Apache is characterized as open-source software. Most popular HTTP server. It is very secure, fast, and reliable.
The Apache Server serves approximately 50% of the current web  pages.  Many programming languages are supported by the Apache Server  are as follows: PHP, Perl, Python and alongside with MySql.  Apache is Open source and is built and maintained over at Apache.org  Apache is comprised of Two main building Blocks 1. Apache Core  2. Apache Modules Very easy to implement and very easy to extend its abilities by the adding of different modules. This is why this server has become so popular.
Apache Overview Diagram As you can see the designers of Apache decided to take a modular approach so that anyone can add to the basic functionality of the server without disturbing the basic Core implementation.
Apache Web Server Where all the Magic Happens… The Apache Web Server is comprised of a Modular approach . This allows for more robustness and  better customization without getting rid of the security that is implemented within the Apache Core. Apache Designers decided to break down the server into two main Components. The Apache Core:  Which Handles the Basic functionality of the Server. Such as allocating requests and maintaining and pooling all the connections. The Apache Modules:  The added extensions to the server which handle a lot of the other types of processing the server must achieve such as doing user Authentication.
MySQL
MySQL MySQL is a popular, scalable, free, open-source database management system (DBMS). It runs on Windows, Linux, and many other operating systems. MySQL AB, the Swedish company that owns the codebase offers services, extra tools, and licensed versions. MySQL AB states that MySQL is used in 11 million installations in the world. We will use phpMyAdmin to access MySQL through Apache.
Creating Database Tables 􀂄  Create  web_db  database to hold the tables: 􀂄  CREATE DATABASE web_db; 􀂄  To create a table called notes: 􀂄  USE web_db; 􀂄  CREATE TABLE notes (...); 􀂄  insert some rows for testing if necessary 􀂄  It is easy to write an sql script called notes.sql  and use monitor to execute it
The Basic Queries 􀂄  CREATE 􀂄  create databases and tables 􀂄  SELECT 􀂄  select table rows based on certain conditions 􀂄  DELETE 􀂄  delete one or more rows of a table 􀂄  INSERT 􀂄  insert a new row in a table 􀂄  UPDATE 􀂄  update rows in a table 􀂄  ALTER 􀂄  alter the structure of a table
ADVANTAGES Very Fast. Reliable and Easy to use. Multi-threaded multi-user and robust SQL  database server.
DISADVANTAGES Does not support Stored Procedures and Triggers. MySQL doesn't yet support the Oracle  SQL extension: SELECT ... INTO TABLE , but supports INSERT INTO ...  SELECT ..
PHP
PHP PHP is popular, simple and lightweight server-side scripting language used to create dynamic web pages. History: 1995: PHP 2, “Personal Home Page Tools” 1997: PHP 3, “PHP: Hypertext Processor” 2000: PHP 4 2004: PHP 5 Some sites that use PHP: Wikipedia, Yahoo, Digg, Facebook
Server-Side Scripting On the server, PHP code produces HTML. Client only receives HTML. Client can't view the original PHP code. Compare with HTML: <b> This is readable on the page </b> <!--  This is visible if you view source --> <?php   // PHP source is not visible  ?>
helloworld.php <html> <head> <title> PHP: Hello World </title> </head> <body> <h1> PHP Says: </h1> <?php echo &quot;Hello World!&quot; ?> </body> </html>
 
helloform.php 1/2: PHP Processing <html> <head><title> PHP: Hello Xyz </title></head> <body> <?php if (array_key_exists('user', $_GET)) { // Without stripslashes, O'Reilly appears as O\'Reilly $user = stripslashes($_GET['user']); } else { $user = 'Stranger'; } ?> <h1> Hello   <?php   echo $user   ?> </h1>
helloform.php 2/2: HTML Form ...  (1/2: PHP form processing goes here)‏ <!-- Normally, you'll use method=&quot; POST &quot; --> <form method=&quot; GET &quot; action=&quot; helloform.php &quot;> Your Name: <input type=&quot; text &quot; name=&quot; user &quot; size=&quot; 40 &quot;> <input type=&quot; submit &quot; name=&quot; submit &quot; value=&quot; OK &quot;> </form> </body> </html>
 
Connecting to MySQL <?php $con = mysql_connect(&quot;localhost&quot;,&quot;peter&quot;,&quot;abc123&quot;); if (!$con) { die('Could not connect: ' . mysql_error()); } // some code ?>
Advantages of LAMP Easy to code:  Novices can build something and get it up and running very quickly with  PHP  and  MySQL .  Easy to deploy:  Since  PHP  is a standard Apache module, it’s easy to deploy a PHP app. Once you’ve got  MySQL  running, simply upload your .php files. Develop locally:  It’s easy to set up LAMP on your laptop, build your app locally, then deploy on the Web.   Cheap and ubiquitous hosting:  Even the cheapest Web hosts options allow you to run  PHP  and  MySQL
LAMP Is Greater Than the Sum of Its Parts The information provided by the Apache server will be &quot;static&quot;  Adding interactive or dynamic components requires the use of a programming language, like Perl or PHP. For truly interactive and  dynamic Web sites , however, what you need is a way of building pages composed of information in a database.  This is where the power of the LAMP stack shines. By combining a Web server (Apache), dynamic components (using Perl, Python or PHP), and a database (MySQL) you can create a truly database-driven and dynamic Web site that is easy to update and provides rich functionality to support users. pre-packaged applications available that use LAMP technology.:WordPress blogging system. WordPress uses PHP to interface with a MySQL database and can be hosted on an Apache/Linux server.

Lamp

  • 1.
    LAMP ARCHITECTURELinux-Apache-MySQL-PHP PRESENTED BY: ANURAG PANDEY NAKUL LOHRI SAMREEN JAMAL VINITA LALL
  • 2.
    LAMP LAMP standsfor Linux-Apache-MySQL-PHP. Instead of PHP, Perl and Python are also used. This is a free and lightweight alternative to “WISA,” Windows-IIS-SQL Server-ASP (and now, ASP.Net).
  • 3.
  • 4.
  • 5.
    LAMP as FOSSEach of the components in the LAMP stack is an example of Free or Open Source Software Benefits of FOSS approach is three-fold 1. Free download 2. Open licenses and few restrictions 3. Easier to fix faults
  • 6.
  • 7.
  • 8.
    Version of UNIXLinus Torvalds – Creator of Linux Open Source Operating System Free Software Source Code Available Programmer based culture Background on Linux Background on Linux
  • 9.
    Linux vs. WindowsFinancial Differences Technical Differences
  • 10.
    FINANCIAL DIFFERENCES COSTLINUX WINDOWS Online Downloads Free Not Available Retail Price, CD $50 $300
  • 11.
    Cost for BusinessesCompanies have to spend millions for licenses for ever individual windows computer For Linux companies don’t have to spend anything
  • 12.
    TECHNICAL DIFFERENCES Keepingup to date By Upgrading Linux upgrades faster than Windows Compatibility Linux is Backward Compatible unlike Windows
  • 13.
  • 14.
    BACKGROUND OF APACHEWeb Server Initially started in 1996 by Robert McCool. Available for a wide variety of operating systems, including Unix, GNU,Linux, Solaris, Mac OS X, Microsoft Windows. Apache is characterized as open-source software. Most popular HTTP server. It is very secure, fast, and reliable.
  • 15.
    The Apache Serverserves approximately 50% of the current web pages. Many programming languages are supported by the Apache Server are as follows: PHP, Perl, Python and alongside with MySql. Apache is Open source and is built and maintained over at Apache.org Apache is comprised of Two main building Blocks 1. Apache Core 2. Apache Modules Very easy to implement and very easy to extend its abilities by the adding of different modules. This is why this server has become so popular.
  • 16.
    Apache Overview DiagramAs you can see the designers of Apache decided to take a modular approach so that anyone can add to the basic functionality of the server without disturbing the basic Core implementation.
  • 17.
    Apache Web ServerWhere all the Magic Happens… The Apache Web Server is comprised of a Modular approach . This allows for more robustness and better customization without getting rid of the security that is implemented within the Apache Core. Apache Designers decided to break down the server into two main Components. The Apache Core: Which Handles the Basic functionality of the Server. Such as allocating requests and maintaining and pooling all the connections. The Apache Modules: The added extensions to the server which handle a lot of the other types of processing the server must achieve such as doing user Authentication.
  • 18.
  • 19.
    MySQL MySQL isa popular, scalable, free, open-source database management system (DBMS). It runs on Windows, Linux, and many other operating systems. MySQL AB, the Swedish company that owns the codebase offers services, extra tools, and licensed versions. MySQL AB states that MySQL is used in 11 million installations in the world. We will use phpMyAdmin to access MySQL through Apache.
  • 20.
    Creating Database Tables􀂄 Create web_db database to hold the tables: 􀂄 CREATE DATABASE web_db; 􀂄 To create a table called notes: 􀂄 USE web_db; 􀂄 CREATE TABLE notes (...); 􀂄 insert some rows for testing if necessary 􀂄 It is easy to write an sql script called notes.sql and use monitor to execute it
  • 21.
    The Basic Queries􀂄 CREATE 􀂄 create databases and tables 􀂄 SELECT 􀂄 select table rows based on certain conditions 􀂄 DELETE 􀂄 delete one or more rows of a table 􀂄 INSERT 􀂄 insert a new row in a table 􀂄 UPDATE 􀂄 update rows in a table 􀂄 ALTER 􀂄 alter the structure of a table
  • 22.
    ADVANTAGES Very Fast.Reliable and Easy to use. Multi-threaded multi-user and robust SQL database server.
  • 23.
    DISADVANTAGES Does notsupport Stored Procedures and Triggers. MySQL doesn't yet support the Oracle SQL extension: SELECT ... INTO TABLE , but supports INSERT INTO ... SELECT ..
  • 24.
  • 25.
    PHP PHP ispopular, simple and lightweight server-side scripting language used to create dynamic web pages. History: 1995: PHP 2, “Personal Home Page Tools” 1997: PHP 3, “PHP: Hypertext Processor” 2000: PHP 4 2004: PHP 5 Some sites that use PHP: Wikipedia, Yahoo, Digg, Facebook
  • 26.
    Server-Side Scripting Onthe server, PHP code produces HTML. Client only receives HTML. Client can't view the original PHP code. Compare with HTML: <b> This is readable on the page </b> <!-- This is visible if you view source --> <?php // PHP source is not visible ?>
  • 27.
    helloworld.php <html> <head><title> PHP: Hello World </title> </head> <body> <h1> PHP Says: </h1> <?php echo &quot;Hello World!&quot; ?> </body> </html>
  • 28.
  • 29.
    helloform.php 1/2: PHPProcessing <html> <head><title> PHP: Hello Xyz </title></head> <body> <?php if (array_key_exists('user', $_GET)) { // Without stripslashes, O'Reilly appears as O\'Reilly $user = stripslashes($_GET['user']); } else { $user = 'Stranger'; } ?> <h1> Hello <?php echo $user ?> </h1>
  • 30.
    helloform.php 2/2: HTMLForm ... (1/2: PHP form processing goes here)‏ <!-- Normally, you'll use method=&quot; POST &quot; --> <form method=&quot; GET &quot; action=&quot; helloform.php &quot;> Your Name: <input type=&quot; text &quot; name=&quot; user &quot; size=&quot; 40 &quot;> <input type=&quot; submit &quot; name=&quot; submit &quot; value=&quot; OK &quot;> </form> </body> </html>
  • 31.
  • 32.
    Connecting to MySQL<?php $con = mysql_connect(&quot;localhost&quot;,&quot;peter&quot;,&quot;abc123&quot;); if (!$con) { die('Could not connect: ' . mysql_error()); } // some code ?>
  • 33.
    Advantages of LAMPEasy to code: Novices can build something and get it up and running very quickly with PHP and MySQL . Easy to deploy: Since PHP is a standard Apache module, it’s easy to deploy a PHP app. Once you’ve got MySQL running, simply upload your .php files. Develop locally: It’s easy to set up LAMP on your laptop, build your app locally, then deploy on the Web. Cheap and ubiquitous hosting: Even the cheapest Web hosts options allow you to run PHP and MySQL
  • 34.
    LAMP Is GreaterThan the Sum of Its Parts The information provided by the Apache server will be &quot;static&quot; Adding interactive or dynamic components requires the use of a programming language, like Perl or PHP. For truly interactive and dynamic Web sites , however, what you need is a way of building pages composed of information in a database. This is where the power of the LAMP stack shines. By combining a Web server (Apache), dynamic components (using Perl, Python or PHP), and a database (MySQL) you can create a truly database-driven and dynamic Web site that is easy to update and provides rich functionality to support users. pre-packaged applications available that use LAMP technology.:WordPress blogging system. WordPress uses PHP to interface with a MySQL database and can be hosted on an Apache/Linux server.