For PHP you need apache2 daemon (php module), MySQL daemon (or another database server), or easier WAMP (Windows Apache MySql Php) LAMP (Linux Apache MySql Php) or Xamp, or something else...
For Java you need application server like tomcat or jboss,... and a database server (you also need the connector)
The more important is to retrieve data and send it as JSON or XML
PHP is easier way cause you don t need to know about servlet. Just php script and "attack" this url with/without POST/GET to filter datas you want to retrieve.