0

Would just like quick clarification on something.

For a development stack such as LAMP or XAMPP for a local server; does Apache require access over the firewall (e.g. port 80) if, for instance, some php code on the local server echoed data stored on a remote MySQL database (i.e. over the WAN)? I'm assuming yes.

4 Answers 4

2

If I understand your question correctly, the script on your server is acting as an SQL client to the remote MySQL database. This would require your server to be able to access that server. So if there's a firewall between them, it needs to allow that access.

Edit for clarification However, the access that needs to be granted is only for the client to connect to the MySQL server, and for it to receive the responses once the session has been established. There is no reason to allow any other incoming traffic for this purpose.

1
  • Windows doesn't actually specify whether the exception is inbound, outbound, or both. I assumed that it would be both; but it seems that the exception was exclusively in relation to inbound traffic.
    – Stumbler
    Commented Jan 13, 2015 at 14:33
0

I was incorrect. Apache does not require firewall exception for this to work. I verified this by removing software firewall exceptions for Apache HTTP Server.

enter image description here

enter image description here

And my code was able to successfully echo results from remote MySQL database.

Whilst the respective ports must still be open, Apache Webserver does not itself require firewall access for this to work correctly.

1
  • I completely misunderstood your question - it never occurred to me that you were actually wondering if you needed to open incoming access to port 80. As I wrote, you need to make sure that the machine on which the script runs does not have a firewall blocking the access to the SQL server.
    – Jenny D
    Commented Jan 13, 2015 at 12:36
0

Apache, MySQL, Firewalls (whatever software you're using), php, all work independently. They will all do what they are supposed to do with out the others. Apache does not make web request (http, mysql, https, etc).

So the question above perhaps would have been better phrased was not entirely clear. However the meaning was not obscured either.

Another point. "Windows Firewall" is kind like saying Tonka makes a big truck. It is not really a firewall (well not a decent one).

If there is any value do my response it is in the fact that walll these peices of software work independantly. Therefore, when there is a problem they should be tested indepenedantly.
A) Can I access some foreign database server (no php, no apache, no ...) If yes, can I access some foreign database using php (no apache, ...), If can I access some database using php and apache.

I assume you are using php - but if not - the same holds true for other client(s).

-1

If your local PHP code tries to access a remote database (on port 3306 most likely, not 80), you clearly need to open the firewall to allow that access.

5
  • Well duh. Because obviously it is the web server that requires firewall access... even though the web server doesn't operate on port 3306... obviously. Since http is by default not blocked by software firewalls (else browsers would require specific permissions in order to work) the answer actually isn't 100% obvious. Now, I would assume that it is "yes", but I'm not completely, absolutely sure. But sure I could just guess, like you.
    – Stumbler
    Commented Jan 13, 2015 at 10:03
  • @Duncan To most of the people frequenting Server Fault, it actually is obvious - like "do I need the door to that room to be unlocked in order for me to open it and pass through it" obvious. This is why the question was moved to Super User, which is a more appropriate site for this.
    – Jenny D
    Commented Jan 13, 2015 at 10:46
  • @JennyD Ah! Because SuperUser is for dumdums. So the question wasn't downvoted for being a bad question, as such, but rather an idiotic one. Clearly it was so offensive to the amazing genius of the denizens of serverfault that it remaining there simply couldn't be tolerated as it lowered the tone. Normally I would just allow the firewall exception and be happy that the thing works; but I was hoping for a more nuanced answer than "of course it works, jackass."
    – Stumbler
    Commented Jan 13, 2015 at 11:45
  • @JennyD No I take it back; you are both wrong. Set up virtual machine and removed firewall exceptions for Apache and it works totally fine. Thank you for wasting my time
    – Stumbler
    Commented Jan 13, 2015 at 12:13
  • 1
    @Duncan Not for dumdums; for people who don't have the background in systems administrations. I don't say that I'm a dumdum for not having a deep knowledge of the engine of a train. And I'd say that by posting in the wrong place, you wasted both your time and ours - we simply did not understand how the question you were trying to ask even needed asking, so we answered what we thought you were asking. Again, I am saying nothing about your level of intelligence (or my own) - simply that we did not understand one another due to a difference in experience.
    – Jenny D
    Commented Jan 13, 2015 at 12:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .