Saturday, February 25, 2012

basic explanation of LAMP for dummies


for a while i was trying to figure out how the following terms fit with each other: html, xml, javascript, LAMP, ajax, php, front end, back end, ruby on rails.



so far i believe it's like this:


LAMP is about how the server is configured. L=linux, A=apache, M=mysql, P=php. then the client stuff goes on top of that: ajax, javascript, html


a webpage from a website can have html and javascript on the same page. (it needs to have html to be known as a webpage. it doesn't need to have javascript). when you type in the url of a website in your web  browser (eg google chrome), the sever that the website is hosted on sends the index.html webpage over to your web browser (index.html is the main/home webpage) .
the web browser immediately renders the html stuff and displays you something.
javascript on the other hand, needs to be executed by the web browser (the browser sees javascript and starts running what the javascript is saying). javascript has many functions, for example, it can cause a popup window. one of the functions is called XMLHttpRequest, which can call out to run php scripts that reside on the sever (all of ajax is is basically the capability of that function, which allows you to call php scripts).

Well the php scripts reside on the webserver and they usually have within them mysql scripts. Mysql is the language used by the database, and the php scripts call the mysql queries, which gets stuff from the database.

So the php script then gets the data from the database and then reorders that data into xml. I think of xml just as a format of presenting information. just like how you can have a line of english words to make a sentence, you can alternatively have have a column of words, where each row only has one english word, and everyone knows that word 1 is capitalized, or something. So the php script gives the data in xml format to the javascript (rather, the XMLHttpRequest function retrieves that xml data for other javascript functions to use). and since javascript knows the data is in xml format, it also knows that word 1 is capitalized, or something. (remember, the browser is running the javascript, so by now, the xml data is on the browser)

Anyway, then javascript uses that data, prints it as html or something, and that's how your webpage gets updated. or something.

Note that the user (the person sitting in front of the computer) will never see the php scripts. Because php resides on the server.

(stuff that has to do with the web browser is front end, and stuff that has to do with the webserver is backend)

and ruby on rails (RoR) is just a whole other beast that replaces LAMP. i think...

correct me where i'm wrong because i'm just learning this stuff so it's new to me as well.

No comments:

Post a Comment