Page 1 of 2
What's the problem?
Posted: Thu Apr 30, 2009 1:22 am
by s2009
Hi all
I am beginner learning Php.
I have installed Php Designer 2008. I have written first program in Php as follows :
Code: Select all
<html>
<head>
<title>Untitled 2</title>
</head>
<body>
<?php
echo "HELLO WORLD"
?>
</body>
</html>
I have saved the above file with .php extension. But when I try to open the file in InternetExplorer it is opening the file in DreamWeaver. And if I try to open it in FireFox Mozilla it is just displaying blank page.
Can anyone help me to get the desired output.?
Please help me out.
Thanks in advance!!
Re: What's the problem?
Posted: Thu Apr 30, 2009 1:31 am
by Benjamin
You are missing a semi-colon on line 8. The reason you are getting a blank page is more than likely because your installation of PHP has error reporting turned off. You are going to want to find your php.ini file and locate the error_reporting and display_error settings. Once you turn those on, PHP will tell you what the errors are.
Re: What's the problem?
Posted: Thu Apr 30, 2009 1:50 am
by s2009
thanks for ur prompt reply.
Even after giving semicolon and changing the settings in php.ini configuration files for error_reporting as Yes. It is still displaying the blank page.
What should I do?
Please help me.
Re: What's the problem?
Posted: Thu Apr 30, 2009 2:03 am
by Benjamin
Put this in a file and post the output please:
Also, try testing your php installation:
Re: What's the problem?
Posted: Thu Apr 30, 2009 7:03 am
by s2009
Thanks for your reply
When executing the first code of statements it is not displaying anything in the Internet Explorer but in the Mozilla FireFox it is displaying just hello.
But when the second code of statements is executed it is not displaying anything.
Now what should I do?
Please help me out
Re: What's the problem?
Posted: Thu Apr 30, 2009 12:11 pm
by Benjamin
What is the address in your browser when you view these files?
Re: What's the problem?
Posted: Fri May 01, 2009 1:09 am
by s2009
Thanks for all your replies.
The address of the Browser (Mozila FireFox) is :
file:///C:/Documents%20and%20Settings/Admin/Desktop/a.php
Re: What's the problem?
Posted: Fri May 01, 2009 3:19 am
by Benjamin
PHP code is not processed when you access a file directly. You need to install a webserver as well as PHP. Please have a look at xamp because it will install this for you:
http://www.apachefriends.org/en/xampp-windows.html
Once you have it up and running, you can view webpages locally by accessing
http://localhost/pagename.php in your browser.
Re: What's the problem?
Posted: Fri May 01, 2009 6:40 am
by s2009
Thanks for your reply.
I have installed the WAMP server.
But still i am not able to execute my PHP files.
Now what should I do to execute my PHP files?
Please help me out.
Thanks in advance!!
Re: What's the problem?
Posted: Fri May 01, 2009 8:41 am
by susrisha
you need to place your file in the root directory or its subdirectories of the server.
If its WAMP that you are using, i beleive the root folder will be www
goes like this..
save your file in the following location
path_to_www/yourfile.php
Access the same through the browser as
http://localhost/yourfile.php
And let us know what the output is.
Re: What's the problem?
Posted: Fri May 01, 2009 12:01 pm
by s2009
susrisha wrote:you need to place your file in the root directory or its subdirectories of the server.
If its WAMP that you are using, i beleive the root folder will be www
goes like this..
save your file in the following location
path_to_www/yourfile.php
Access the same through the browser as
http://localhost/yourfile.php
And let us know what the output is.
Thanks for your reply.
It is displaying "The page cannot be found".
Please note that the WAMP server is put online only.
What should I do to run my PHP files?
Please please help me out.
Thanks in advance!!
Re: What's the problem?
Posted: Fri May 01, 2009 12:20 pm
by watson516
If your wamp server is running then you should make sure that your file is in the correct directory (C:\wamp\www by default). Then just open up a web browser and type in localhost.
Re: What's the problem?
Posted: Fri May 01, 2009 12:20 pm
by user___
Read this for Windows:
http://www.php-mysql-tutorial.com/wikis ... mysql.aspx
There are a lot of tutorials for that on the Internet.
Re: What's the problem?
Posted: Fri May 01, 2009 12:22 pm
by s2009
watson516 wrote:If your wamp server is running then you should make sure that your file is in the correct directory (C:\wamp\www by default). Then just open up a web browser and type in localhost.
Thanks for your prompt reply.
I have saved it in the correct directory only but when I am trying to execute the file by using the localhost command it is displaying the following error page:
The page cannot be found
The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.
Please try the following:
* If you typed the page address in the Address bar, make sure that it is spelled correctly.
* Open the localhost home page, and then look for links to the information you want.
* Click the Back button to try another link.
HTTP 404 - File not found
Internet Information Services
Technical Information (for support personnel)
* More information:
Microsoft Support
Please reply me what the error is and how to detect it?
Thanks in advance!!!
Re: What's the problem?
Posted: Fri May 01, 2009 12:31 pm
by watson516
A 404 error means that the file isn't there.
Are you running an IIS server or Apache? WAMP is apache. That error you posted appears to be from an IIS server (I could be wrong but the whole Internet Information Services kind of gives it away)
If you're not running wamp, then you need to save the file in whatever location IIS is looking at. If you're running multiple web servers at once, close down the others and just run wamp.