Page 1 of 1

cannot display php file in browser

PostPosted: 23. May 2013 15:54
by terrys
I am new to PHP so bear with me, have a bit of patience. I have installed the latest xampp software, all installed okay. The control panel shows no error messages. I have created a simple test file to test the browser but all I get is "error" or "cant find" messages. I have tried "localhost/testfile" and "127.0.0.1/testfile" but with same result. My testfile is located in htdocs. If I type in localhost/xampp it opens the xampp index html. So something works.

Re: cannot display php file in browser

PostPosted: 23. May 2013 16:55
by Altrea
Hi terry,

Please start new threads with the words "Hi" or "Hello". A short salutation is an act of politeness. Even if the internet is an virtual area, there is always a human being behind the screen. A polite beginning is the first positive impression you can leave here and helps to get polite answers too. Please keep that in mind if you start a new thread in any community board.

terrys wrote:I have created a simple test file to test the browser

In your file properties menu (rightclick context menu), what is the "Type of file" property of that file?

terrys wrote:but all I get is "error" or "cant find" messages.

Full error messages please.
The contents of your \xampp\apache\logs\access.log could also be helpful.

terrys wrote:I have tried "localhost/testfile" and "127.0.0.1/testfile" but with same result.

the name of your file is just testfile? without any file extension?

best wishes,
Altrea

Re: cannot display php file in browser

PostPosted: 24. May 2013 10:34
by terrys
Hi,
Sorry if I cause any offense re my first post.
Okay, the testfile is "testfile.php"
this is the type of error message I get......

TalkTalk
Sorry, we could not find localhost.testfile.
Search results provided by Yahoo!

Check your IP address
Check and obtain your current IP address in one second.
Sponsored by: www.speedtestcentral.com

localhost - Wikipedia, the free encyclopedia
In computer networking, localhost means this computer. It is a hostname that the computer's software and users may employ to access the computer's own network ...
en.wikipedia.org/wiki/Localhost.

Sometimes it's just a blank screen.

Hope this helps.

Regards

Terrys

Re: cannot display php file in browser

PostPosted: 24. May 2013 11:22
by terrys
Hi,
Sorry should have added this error message to my previous post.....
Object not found!

The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster.
Error 404
localhost


Regards

Terrys
Apache/2.4.3 (Win32) OpenSSL/1.0.1c PH

Re: cannot display php file in browser

PostPosted: 24. May 2013 15:41
by Altrea
Hi Terrys,

Try http://localhost/testfile.php
what is the contents of this testfile.php file?

best wishes,
Altrea

Re: cannot display php file in browser

PostPosted: 24. May 2013 16:45
by terrys
Hi. Altrea,
Think I've found the answer, I went back into he file properties and note it was set to open with Dreamweaver, changed it to open with PHP ide and it's now working okay.I am using "PHP Coder ide" to learn and write code, is this my best option ?
Anyway many thanks for your interest.
Regards

Terrys

Re: cannot display php file in browser

PostPosted: 24. May 2013 17:31
by Altrea
terrys wrote:I went back into he file properties and note it was set to open with Dreamweaver, changed it to open with PHP ide and it's now working okay.

No. This setting is just relevant for Windows, not for the Apache webserver.
php files have to be requested by url from a webserver because they need to processed before delivered to the browser.
Thats why you cannot doubleclick or drag and drop a php file inro your browser.

terrys wrote:I am using "PHP Coder ide" to learn and write code, is this my best option ?

Ask 100 PHP developers which the best IDE is and you will get 101 different answers.
Try out different IDEs and use the one you are most effective with.

I for example use phpstorm (IDE) and Sublime Text 3 (Texteditor) for personal use and Zend Studio at work. All of them are commercial licenses.

But there are some good free IDEs too like Eclipse PDT or NetBeans and the free editor Notepad++

P.S.: I really don't like DreamWeaver :D

Re: cannot display php file in browser

PostPosted: 27. May 2013 17:26
by terrys
Hi , Well I'm back again..... with the same problem, suddenly once again I cannot display anything in localhost. Ive tried all sorts of address variations but get the 404 error code.
Am using " PHP Coder" to write the code, Even the phpIfo(); will not display.

Re: cannot display php file in browser

PostPosted: 27. May 2013 17:44
by Altrea
I think we can't help you if you don't tell us step by step what you are doing, where you are doing it and what result you are getting.
I have installed PHP Coder IDE to follow your steps, so lets get started :D

Re: cannot display php file in browser

PostPosted: 27. May 2013 18:48
by terrys
Hi.
Here is the simple code I wrote to test the system.....

<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
<title>Title here!</title>
</head>
<body>
<?php
echo "testing page";
phpInfo();
?>

</body>
</html>
Saved as "testing page.php"
and saved in zampp/htdocs.
I open the browser, Firefox... and type in....... localhost/testing page.php.
and get the 404 error rmessage

Regards

terrys

Re: cannot display php file in browser

PostPosted: 27. May 2013 19:09
by Altrea
maybe you wanna try it without the whitespace in the filename!?
What happens if you request only http://localhost/ ?

Re: cannot display php file in browser

PostPosted: 28. May 2013 09:38
by terrys
Hi,
Have tried it without white space .... same error message 404. When using the address " localhost" only will open the "xampp for windows page"

Re: cannot display php file in browser

PostPosted: 28. May 2013 12:34
by JJ_Tagy
I think he means rename your file to testingpage.php and then request http://localhost/testingpage.php

Re: cannot display php file in browser

PostPosted: 28. May 2013 13:03
by terrys
Hi,
Okay, I have now renamed the test page.php to testpage.php and is now working okay. thank you for your help.