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?)

8
  • 3
    Is your server running? Commented Oct 23, 2014 at 22:49
  • try sticking 127.0.0.1 in your browser address bar Commented Oct 23, 2014 at 22:49
  • @andrew i get a blank page Commented Oct 23, 2014 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" Commented Oct 23, 2014 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. Commented Oct 23, 2014 at 23:23

3 Answers 3

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?

Sign up to request clarification or add additional context in comments.

Comments

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

1 Comment

Thanks aphoe, I'll keep this in mind if IIS ends up blocking the port too.
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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.