cannot display php file in browser

Problems with the Windows version of XAMPP, questions, comments, and anything related.

cannot display php file in browser

Postby terrys » 23. May 2013 15:54

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.
Still trying !
terrys
 
Posts: 18
Joined: 23. May 2013 15:17
Location: Southampton
Operating System: windows 7 64bit

Re: cannot display php file in browser

Postby Altrea » 23. May 2013 16:55

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
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11935
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: cannot display php file in browser

Postby terrys » 24. May 2013 10:34

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
Still trying !
terrys
 
Posts: 18
Joined: 23. May 2013 15:17
Location: Southampton
Operating System: windows 7 64bit

Re: cannot display php file in browser

Postby terrys » 24. May 2013 11:22

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
Still trying !
terrys
 
Posts: 18
Joined: 23. May 2013 15:17
Location: Southampton
Operating System: windows 7 64bit

Re: cannot display php file in browser

Postby Altrea » 24. May 2013 15:41

Hi Terrys,

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

best wishes,
Altrea
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11935
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: cannot display php file in browser

Postby terrys » 24. May 2013 16:45

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
Still trying !
terrys
 
Posts: 18
Joined: 23. May 2013 15:17
Location: Southampton
Operating System: windows 7 64bit

Re: cannot display php file in browser

Postby Altrea » 24. May 2013 17:31

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
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11935
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: cannot display php file in browser

Postby terrys » 27. May 2013 17:26

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.
Still trying !
terrys
 
Posts: 18
Joined: 23. May 2013 15:17
Location: Southampton
Operating System: windows 7 64bit

Re: cannot display php file in browser

Postby Altrea » 27. May 2013 17:44

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
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11935
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: cannot display php file in browser

Postby terrys » 27. May 2013 18:48

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
Still trying !
terrys
 
Posts: 18
Joined: 23. May 2013 15:17
Location: Southampton
Operating System: windows 7 64bit

Re: cannot display php file in browser

Postby Altrea » 27. May 2013 19:09

maybe you wanna try it without the whitespace in the filename!?
What happens if you request only http://localhost/ ?
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11935
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: cannot display php file in browser

Postby terrys » 28. May 2013 09:38

Hi,
Have tried it without white space .... same error message 404. When using the address " localhost" only will open the "xampp for windows page"
Still trying !
terrys
 
Posts: 18
Joined: 23. May 2013 15:17
Location: Southampton
Operating System: windows 7 64bit

Re: cannot display php file in browser

Postby JJ_Tagy » 28. May 2013 12:34

I think he means rename your file to testingpage.php and then request http://localhost/testingpage.php
JJ_Tagy
 
Posts: 788
Joined: 30. January 2012 13:44
XAMPP version: 5.5.15
Operating System: Windows 10 Pro x64

Re: cannot display php file in browser

Postby terrys » 28. May 2013 13:03

Hi,
Okay, I have now renamed the test page.php to testpage.php and is now working okay. thank you for your help.
Still trying !
terrys
 
Posts: 18
Joined: 23. May 2013 15:17
Location: Southampton
Operating System: windows 7 64bit


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 153 guests