Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I keep hearing about the popular LAMP and WAMP configurations for the server side and also know that LAMP stands for Linux, Apache, MySQL, PHP/Python/Perl/Ruby etc..
But I don't know how all of these integrate with each other.
For instance If I have Xampp installed on my windows machine at home and it has an htdocs folder where I store my webpages...and when I query that page the browser shows it to me...
I need to know what:

  • Apache actually does is it just a hard drive for my web pages?
  • Where does PHP/Python/Perl/Ruby and MySQL fit in?
  • Like Xampp has htdocs on my pc is there a similar folder on the Apache Web server?

Its all confusing at the moment, can anyone explain?

share

migration rejected from stackoverflow.com Apr 9 at 22:26

This question came from our site for professional and enthusiast programmers. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as too broad by Grant, mdpc, MichelZ, Rex, Ward Apr 9 at 22:26

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

5 Answers 5

up vote 11 down vote accepted

These are extremely general questions. You should probably do some reading on Wikipedia or other sites about databases, web frameworks, and web servers.

However, just to give you a quick rundown:

A web server is a program that serves data to people who access your machine over the World Wide Web. The two most popular web servers in the world are Apache and Microsoft Internet Information Services (IIS).

A database stores data, most commonly in a relational manner. You can use this data for web content, i.e. it can store blog posts, usernames and passwords, basically anything. The most common databases used for web development are SQL variations, most popularly MySQL and MS SQL Server.

PHP, Python, Ruby, and Perl are high level languages, what might once have been called scripting languages (but have become so much more). There are various technological and philosophical differences between them, but they are all used to the same ends. In web terms, these languages are used to program dynamic web content. Your web server runs the PHP/Ruby/Perl/Python code, and that code, in combination with data from a database and/or HTML pages, outputs the web content that is served by your web server software and ultimately seen by the user. All of these languages have various frameworks to make web development with them easier (i.e. Rails for Ruby).

XAMPP is just a prepackaged kit containing the apache web server, the mysql database software, and PHP and Perl installations.

A basic flow of the process of serving a page is as follows:

  1. A remote user requests http://www.yoursite.com/index.php
  2. Your Apache web server software receives that request and prepares to serve the appropriate information over the connection to that specific user
  3. Apache's integration with PHP starts the PHP interpreter on your server and executes the PHP code in index.php
  4. That PHP code may in turn contain requests to get and/or set data from your MySQL database to use in the web page or for user or session management.
  5. Your web server sends the remote user an HTML document that is put together through the above combination of PHP code, database information, and pre-written static HTML and CSS from your web site.

Also, to answer your question about whether Apache is just a "hard drive for your web site", that's not the case. Some things Apache does for you include managing many users connections to your site, executing the proper interpreters for dynamic web pages, controlling access to various pages, redirecting users to various content, and many more things. The web server software is the central point at which all sorts of languages, development frameworks, encryption systems, authentication and access controls, and other technologies intersect to create a fully functioning website.

share
    
Very informative answer!! –  Kevin Boyd Sep 26 '09 at 5:16
    
+1 for tackling ambiguities and naivete. –  whatnick Sep 26 '09 at 5:18
    
Thanks bdonlan for fixing my list:) –  phoebus Sep 26 '09 at 5:50

Apache is a web server that opens a port on your computer to the connected network. This lets people in your network go to http://192.168.1.101 (your IP address). If you have your router configured correctly, then you can throw up a website of your own.

Out of the box, apache delivers HTML to the browser. If you view the source of this page, then you can see HTML.

PHP/Python/Ruby are languages that be used to interface with Apache to create HTML on the fly (dynamic behavior).

MySQL is persistance for your data. It stores your data in a way that PHP/Python/Ruby can easily transform and display.

Xampp uses Apache.

share

Apache the a web server which actually listens to your requests to localhost or 127.0.0.1 then reply based on the request. Normally Apache listens to port 80, 8080 and so on

PHP, Python, Perl Ruby are server side includes (or scripts) which you as a programmer write in. When Apache receives a request, it will look up these files, and ask the respective parsers to parse and return the output.

E.g. you call http://localhost/test.php. Apache receives the call and looks up the file test.php in htdocs. Since it is a PHP file, Apache will call PHP to parse the file, then return the HTML or any output.

MySQL is the database to store your data. Think about all these StackOverflow posts, they are all stored in a Database.

htdocs is just a folder defined to be the root of the web server. You can re-configure and change it to some other folder.

share

The way it works is that when the file is requested, it is first put through an interpreter, then sent to the client.

Here is a list of steps:

  1. Browser requests /index.php
  2. Server Program sends it to the interpreter defined in a mod/config file
  3. Interpreter interprets the file and sends the output back to the Server Program
  4. Server Program sends the now plain HTML file to the client
  5. Browser recieves and parses the HTML to show what you see as the website

As for MySQL, MySQL is a database, to allow storing of data such as usernames, passwords and other info.

share
    
Is Apache the "Server Program" you mention over here? –  Kevin Boyd Sep 26 '09 at 5:49

Server side technology is technology that works on a server and not on a client. Sorry but this is IMHO the only correct answer to this total general question.

share
    
It must be very difficult for you, only being able to read titles at SO. –  phoebus Sep 26 '09 at 5:55

Not the answer you're looking for? Browse other questions tagged or ask your own question.