Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2009
    Posts
    1

    Unanswered: LAMP / WAMP Inner Workings

    Hi!

    I'm new to MySQL and LAMP / WAMP based systems and have a question on how things work ( I've done some PHP / MySQL coding, but at a very high level on systems that were already setup so my knowledge is pretty limited ). If anyone can help me out or point be in the right direction that would be great ( I've tried Google, but found it hard to get specific answers to my specific question )! Thanks in advance...

    In a LAMP / WAMP based system I understand that the web-server ( Apache ) is constantly running on the machine and listening to port 80. When it receives a request from a client for a PHP page, it'll say "Hey, this is PHP! Instead of simply returning the file contents to the client, I need to run it through the PHP interpreter and return the result!". So, it runs the PHP script which will ( if trying to talk to MySQL ) use the mysql_connect and mysql_select_db commands. Here's where I'm not sure what's going on. How exactly is it communicating with MySQL? Does it simply run the mysql program on the local system? Or, since the mysql_connect function takes a host name ( IP Address ), does that mean it sends a request through the network to MySQL? If so, does that mean that MySQL is always running and listening on a specific port ( similar to how Apache works )?

    I guess my question really boils down to this: I understand the very high level concept of how a web-server works ( ie. Apache talks to PHP, which talks to MySQL and does some DB manipulation or data grabbing, PHP echos the result, which Apache then sends back down to the client )...but I'd like to know more specifics on exactly what is happening at each of these steps.

    Any specifics on how the nitty-gritty of this whole process works would be great in helping me fully understand everything!

    Thanks again!

  2. #2
    Join Date
    Nov 2008
    Posts
    28
    I'm in somewhat of the same boat, so I'm hoping someone more knowledgable comes along shortly!

    I've been mucking about with XAMPP here lately a little bit; there are settings in the httpd.conf and my.ini/my.cnf (depends on the install, I gather) files that should dictate what interface and port the servers listen on. As an example, to make the Apache server bit of my Portable Apps XAMPP install listen only on the localhost aka loopback interface on port 80, I modified a line in httpd.conf to 'Listen 127.0.0.1:80'. I believe mysqld by default listens on port 3306, but there are ways to make it skip listening to the network and just respond to commands passed directly to it via unix pipes and such (via the 'skip_networking' configuration option), but thats where I'm pretty much at my limit on that sort of thing Personally I'm kind of curious as to whether Apache/PHP would still work with the MySQL server on the same machine if the 'skip_networking' was turned on - for me on a local machine, run from a usb thumb drive, I'm not keen on having a server running on an open port if not necessary - even temporarily. I'll have to play with it some more - carefully.

    HTH,

    Monte

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •