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:
- A remote user requests http://www.yoursite.com/index.php
- Your Apache web server software receives that request and prepares to serve the appropriate information over the connection to that specific user
- Apache's integration with PHP starts the PHP interpreter on your server and executes the PHP code in index.php
- 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.
- 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.