0

I'm trying to follow a tutorial for my first php project in netbeans. I select new php application name it and then simply type echo("anything") in the php portion of index.php and when I run it I always get the error Oops! Google Chrome could not connect to localhost. I don't understand why because I also have a Java web application(selection from netbeans) and when I put stuff in the html I can get things to run just fine. How can I get rid of this issue?

Nick L
  • 281
  • 1
  • 5
  • 18

2 Answers2

1

Make sure that PHP is running on your machine (XAMP or WAMP) and it should be echo "anything";

mfsymb
  • 433
  • 6
  • 18
  • Is that something that is included in the PHP download, or will I have to download that separately? – Nick L Apr 18 '14 at 16:06
  • no, you need to download XAMPP or WAMP separately. https://www.apachefriends.org/ http://www.wampserver.com/ Download one of these. Start the server and you are good to go. – mfsymb Apr 18 '14 at 16:11
0

PHP requires that the PHP parser is running on a server. The error comes from a lack of this. HTML requires no parser so it can be sent as is. The java web application may have a module to enable PHP, and you likely need to either enable it or tell it where a PHP binary is; if not both.

Alternatively, you can use XAMPP/MAMPP to host the server; just make sure it is not running on the same port as your java host.

You can get XAMPP/MAMPP here: www.apachefriends.org

Nicholas Summers
  • 3,611
  • 2
  • 16
  • 32