3

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?

HopelessN00b
  • 53,795
  • 33
  • 135
  • 209
Kevin Boyd
  • 191
  • 2
  • 10

3 Answers3

11

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.

phoebus
  • 8,380
  • 1
  • 31
  • 30
1

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.

1

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.

mauris
  • 283
  • 1
  • 3
  • 9