Differences

This shows you the differences between two versions of the page.

what_is_lamp [2005/06/01 11:52] (current)
Line 1: Line 1:
 +====== LAMP ======
 +===== Definition =====
 +
 +**LAMP** is an acronym for **L**inux **A**pache **M**ySQL **P**HP. It is a high performance platform for serving dynamic and persistent web pages. It is also known as WAMP (when it is run on Windows).
 +
 +===== Components =====
 +
 +==== Apache ====
 +
 +[[http://httpd.apache.org|Apache]] is a web server. It's standard behaviour is to serve static web pages. There are many plugins/modules which allow it to serve dynamic pages.
 +
 +==== MySQL ====
 +
 +[[http://www.mysql.com|MySQL]] is a database server. You can think of it as Microsoft Access without the GUI, but with many more advanced features. A more reasonable comparison would be to Oracle, Sybase, etc.
 +
 +==== PHP ====
 +
 +[[http://www.php.net|PHP]] is the "Hypertext Preproccessor". In provides the dynamics of the LAMP platform. PHP pages are designed with a simple programming language somewhat similiar to ASP and C (although far simpler than C). PHP is an apache module.
 +
 +===== How Does It Work? =====
 +
 +Typically, web pages are designed using **HTML**. Sections of code are enclosed and seperated by tags. For instance, the <body> tag is where you would put anything that you want to display to screen. Here is an example web page:
 +\\
 +<code>
 +<html>
 +  <body>
 +    Hello World!
 +  </body>
 +</html>
 +</code>
 +\\
 +The output of the previous page would look like this:
 +\\
 +<code>
 +Hello World!
 +</code>
 +\\
 +To add dynamics to this page we would use PHP. Here's a short example that replaces //world// with someone's name:
 +\\
 +<code php>
 +<?php
 +  $name = 'John';
 +?>
 +
 +<html>
 +  <body>
 +    Hello <?php print $name; ?>
 +  <body>
 +</html>
 +</code>
 +\\
 +PHP code is seperate by special tags that mark when the PHP begins and ends. The front tag is **<?php** and the end tag is **?>**. Anything inbetween these tags are parsed by the PHP module. The above code would look something like this:
 +\\
 +<code>
 +Hello John
 +</code>
 +\\
 +So, let's add some MySQL into the our example. The following example will search the database for names of people that are age 60. As long as John is the only person that meets this criteria, we will see the exact same results as the above example without MySQL. For brevity some of the function parameters were excluded from the example.
 +\\
 +<code php>
 +<?php
 +  // Connect to the database.
 +  $database = mysql_connect();
 +  // Create a query using SQL.
 +  $query = "SELECT name FROM mydatabase WHERE age='60'";
 +  // Run the query, and store the result in a variable.
 +  $name = mysql_query($query);
 +
 +// Display the result to the browser.
 +
 +<html>
 +  <body>
 +    Hello <?php print $name; ?>
 +  </body>
 +</html>
 +</code>
 +\\
 +As you can see, the only thing different about the code is the way that we got the data. In the previous example we assigned **name** manually, but in this one we retrieved it from the database.
 +
 +===== How Do I Get Started? =====
 +
 +Most Linux distributions include all of the pieces required to immediatly get started developing with the LAMP platform. For Windows, there are several packages that will install all of the required components in one easy step. Just search google for LAMP or WAMP.
 +
 +===== References =====
 +[[http://us3.php.net/docs.php|PHP Documentation]]
 +\\
 +[[http://dev.mysql.com/doc/|MySQL Documentation]]
 +\\
 +[[http://www.onlamp.com/pub/a/php/2004/02/19/php_foundations.html|PHP/MySQL Tutorial]] [[http://www.onlamp.com/pub/a/php/2004/03/18/php_foundations.html|Part 2]]
 +\\
 +[[http://www.onlamp.com|O'Reilly's OnLamp.com]]
 +\\
 +[[http://www.devshed.com/c/b/PHP/|PHP Tutorials]]
 +\\
 +[[http://www.devshed.com/c/b/MySQL/|MySQL Tutorials]]
 +\\
 +[[http://www.devshed.com/c/b/Apache/|Apache Tutorials]]
 +\\
 +[[http://www.sitepoint.com|Sitepoint.com's Web Development Tutorials]]
 +\\
 +[[http://www.apachefriends.org/en/xampp.html|XAMPP Lamp Distribution]]
 
what_is_lamp.txt · Last modified: 2005/06/01 11:52 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki