Just to clarify, when you say "Java", do you in fact mean "Java", or do you really mean "JavaScript"? (I ask because it is not unusual to see some people using the names interchangeably.
In either case, if your Java[script] application is able to transmit HTTP requests, then certainly you can call a PHP script to do whatever you want it to do. (This is what is done in "AJAX" applications, using JavaScript on the client side of web pages to call server-side scripts.)