1

I’ve just installed WAMP server from http://www.wampserver.com/ And I’m trying to run my first PHP script (hello.php).

This is the code:

<!DOCTYPE html>
<html>
<body>

<?php
echo "My first PHP script!";
?>

</body>
</html>

When I drag hello.php into google chrome, I get a blank screen on the browser. When I copy the file into C:\wamp\www and type http://localhost/hello.php into chrome, I get:

This webpage is not available

Google Chrome's connection attempt to localhost was rejected. The website may be down, or your network may not be properly configured.

Error code: ERR_CONNECTION_REFUSED

Any help is much appreciated.

Thanks.

Edit: The icon in my system tray is yellow (indicating something is wrong maybe?)

hedgesketch
  • 197
  • 1
  • 2
  • 10
  • 3
    Is your server running? –  Oct 23 '14 at 22:49
  • try sticking `127.0.0.1` in your browser address bar – andrew Oct 23 '14 at 22:49
  • @andrew i get a blank page – hedgesketch Oct 23 '14 at 22:55
  • @Robert I'm not sure. How do I know if the server is running? I do know that wampserver is in my system tray and when I hover over the icon it says "WAMPSERVER - server Offline" – hedgesketch Oct 23 '14 at 22:57
  • Click the icon and start the server; if it won't start, then maybe your conf is not correct. Find wherever WAMP puts the apache startup log and see what it tells you. – Codecraft Oct 23 '14 at 23:23
  • possible duplicate of [Installing WAMP](http://stackoverflow.com/questions/4675054/installing-wamp) – Dan Oct 23 '14 at 23:29
  • @Dan, how could this be a duplicate? The two questions aren't similar. –  Oct 24 '14 at 11:04
  • Since the icon is yellow, that means that the service is either idle or there's a problem. To solve this,check the two answers provided. If they don't help, right click on the icon, click stop services. Then right click on the icon again and click start services. Chances are you have something that's blocking your server from accessing your port, or you're connecting on the wrong port. –  Oct 24 '14 at 11:07

3 Answers3

2

Are you using Skype? A common problem when trying to develop locally is, that Skype is blocking Port 80. See this question for further information: Why Skype using HTTP or HTTPS ports 80 and 443?

Community
  • 1
  • 1
JonasB
  • 458
  • 3
  • 9
0

When your your wampserver icon in the system tray shows yellow, it means some services have not started. In this case, it's most likely the apache service that was not started (might be dues to a conflict).

Check for the following

  • Is skype running? Exit skype and restart wampserver again
  • Is IIS installed on your machine? Easiest solution is to change the port of your apache from port 80 to say 8080. (do this via the httpd.conf file). Then try opening http://localhost:8080/hello.php
aphoe
  • 2,586
  • 1
  • 27
  • 31
0

1st ensure that your wamp icon is green(its mean wamp is ready for use) for this purpose you should put your code into php file make helloworld.php file
and put in wamp www folder and run with wamp server.
for hello world program in php just follow this tutorial
but before that you should have wamp server or xamp server on your pc
(wamp/xmap are open source software's and it can easily get from google)
your 1st php program code:-

<?php
echo "hello world";
?>

output:- hello world for more Helping Step by Step Tutorial video:https://www.youtube.com/watch?v=7qtqzhdEX-c
after this tutorial you can able to move other intermediate level programs of php.

Hassan Saeed
  • 6,326
  • 1
  • 39
  • 37