First, check to see if MySQL provides SSL encrypted database connections. If so, that will protect you as you access the database. You will also have to tunnel through the firewall to the server, which is easy if the firewall admin agrees to allow it.
As far as PHP and Java, this is a good reason to use JSP. Just kidding. Sorta. Look at this
Wikipedia link...