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).