[kwlug-disc] Ubuntu 11.04 and LAMP :: Problems w/ MySQL access over 'net

unsolicited unsolicited at swiz.ca
Sat May 14 00:33:13 EDT 2011


John Johnson wrote, On 05/13/2011 11:10 PM:
> On 2011-05-13 21:46, unsolicited wrote:
>> John Johnson wrote, On 05/13/2011 8:14 PM:
> 
> < ... snip ...>
> 
>>> Though LAMP I have MySQL installed.
>>> MySQL works locally.
>>> MySQL works through http://localhost/ see below.
>>> *MySQL does not work through the tubes*.
> 
> < ... snip ...>
> 
>> I don't have the answer, but some thoughts and suggestions:
>> - IIRC, Apache works on names, not numbers. I expect localhost is an 
>> exception, or the browser auto-translates it to 127.0.0.1. So:
>> - if http://localhost/etc works, does http://<real ip address>/etc work?
> 
> http://<real ip address>/etc does indeed work w/caveats
> a) on the Linux box: the ip address is that of my subnet behind the 
> router, i.e. 192.168.0.102
> b) on the Win box: (w/HTTP 500 error): the ip adrress is the 'real 
> world' ip address

For b), you use the same numbers. You cannot browse the www, your own 
www server, from within your own network. You cannot go out and come 
back in on the same interface. This is routing. So, try by internal ip 
address on win box, then by internal name on win box.

You can sort of fool it by putting www.yourhost.com in your hosts file 
as pointing at your internal ip address.

To really test what you're talking about you must be outside your 
network. You could, for example, proxy yourself out via sdf.net.

However, if it works internally, it will work externally. i.e. There 
are internal routing issues, external routing issues, and box / apache 
issues. All I've been responding to here are internal routing issues. 
[If you get to the point of it working inside, but not outside, you 
either have router/firewall issues, or host/firewall issues.] So, I'm 
trying, here, to take internal routing issues off the table.

>> - does http://<mymachinename>/etc work.
> 
> Again http://<mymachinename>/etc does work - on the Linux box.
> http://<mymachinename> is not mapped* such that it can be found from the 
> Win box.
> * I see your suggestions below re hosts.
> 
>> - From windows, if you do telnet 80 <ipaddress>, does anything good 
>> happen, like, text of any sort? If you type in 'get stuff' do you get 
>> file not found sort of thing?
> 
> telnet -l username 192:168.0.102 80 did bring up something - the text of 
> the index.html file on the Linux box

Good. So we've eliminated both an ip routing issue, and a box firewall 
issue. If you add the hosts and try the http://machinename from the 
win box, you'll eliminate a name routing issue potential.

> I did not mention above that the etc part of the http://<real ip 
> address>/etc is a path name to my test file.
> And that if the etc is left out as in http://<real ip address>/ the 
> browser brings up index.html

> index.html executes locally (in the Linux box) and remotely from the 
> WinXP box
> other files, with php extensions & php code, also execute locally (in 
> the Linux box) and remotely from the WinXP box

Remember, nothing executes anywhere other than within the linux box. 
Apache just receives and sends requests. Typically it sends html 
pages. Apache, upon receiving a request, turns around and calls the 
designated program, asking for a file it will send out.

Arguably, a test is a helloworld.php program to eliminate an apache 
'cgi' issue of site, path, designated program, etc. If 
mysite/hello.php works locally, by localhost, ip, and name, and does 
so from win, it should do so from everywhere. [Actually, if you can 
prove that, you can narrow your original problem to being solely 
within the linux box.

If that all works, then query a single test record from within mysql, 
and prove all that works.

If so, then either you've discovered the problem, or you've narrowed 
it down to being a mysql permissions problem, or an php <-> mysql 
problem. (Can you get your php script to write out a second copy of 
the result to /var/mypageresult.txt or something?)

> the problem is when MySQL code is buried in the php files, these files 
> execute locally through localhost and through 192.168.0.102
> but not remotely from the WinXP box
> it could be a caller permissions or access error - hence my attempt to 
> use chmod
> btw: php code w/o the MySQL code is in the same directory as php code 
> with the MySQL code (so not a perms error on the dir)

The source of the request is transparent to mysql or php. Apache got a 
request, turned around and called your program. There isn't even an ip 
address involved at that point. It is always the same caller.

Can you turn on an apache log to see what requests it gets / pages it 
serves?

When you try from win, does view / source reveal anything interesting?




More information about the kwlug-disc mailing list