As I read your post, you are saying that texdebug.php renders the image? If so, then everything is working properly. There's something else going on.... and here's what it is:
I just re-read your original post. I see that you put your LaTeX markup in an HTML file that you uploaded to Moodle and then linked to from a resource. Such files are not filtered! Try "Compose a web page" instead.