[solved]Eror browser displays PHP as a plain text

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

[solved]Eror browser displays PHP as a plain text

Postby asaf » 06. May 2012 01:07

using xampp with apache, mysql running. IT WORKED FINE with php. suddenly it's not reading the code anymore.
running PHP file from htdocs (index, or just a simple <?php?>
chrome displays regular text (showing the code)
explorer wont even display the screen (open and immediately closing)
got the latest versions of each. tried re-install.
what can be the problem?
help...
thnx,
asaf
asaf
 
Posts: 5
Joined: 06. May 2012 01:00
Operating System: win7

Re: Eror browser displays PHP as a plain text (showing the c

Postby Altrea » 06. May 2012 01:10

Hi asaf (there is ALWAYS time for a welcome line, especially if you want to request for help. That's a matter of politeness),

how do you open/request the files?
What does your browsers address bar show if you just get the plain code?

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: 11926
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: Eror browser displays PHP as a plain text (showing the c

Postby asaf » 06. May 2012 01:39

thnx and hello :)
i run the file from notepad++ run-->lunch in chrome, than i get plain text. address bar shows: file:///C:/xampp/htdocs/index.php
I also tried to run it from the address bar by typing : http://localhost/htdocs/index.php and i get an error message:

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
05/06/12 03:38:10
Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1

have any idea?
thnx
asaf
thnx,
asaf
asaf
 
Posts: 5
Joined: 06. May 2012 01:00
Operating System: win7

Re: Eror browser displays PHP as a plain text (showing the c

Postby hackattack142 » 06. May 2012 04:39

You do not need to include the "htdocs" in your URL. If there is a file in the htdocs folder you want to display, you can simply put http://localhost/index.php
XAMPP Control Panel Developer
Latest CP: viewtopic.php?f=16&t=48932
hackattack142
 
Posts: 701
Joined: 20. May 2011 23:29
Operating System: Windows 7 Ultimate SP1 64-Bit

Re: Eror browser displays PHP as a plain text (showing the c

Postby asaf » 06. May 2012 10:17

hi,
I tried to do that - doesn't work for me. when I put http://localhost/index.php it jumps to http://localhost/xampp/index.php which is the homepage of my server but not the file.
I tried a test file called test.php the same path - and it gave me the same Eror message.
is it possible that my antivirus or firewall preventing xampp to operate?
thnx,
asaf
asaf
 
Posts: 5
Joined: 06. May 2012 01:00
Operating System: win7

Re: Eror browser displays PHP as a plain text (showing the c

Postby Altrea » 06. May 2012 11:34

Hi asaf,

asaf wrote:I tried to do that - doesn't work for me. when I put http://localhost/index.php it jumps to http://localhost/xampp/index.php which is the homepage of my server but not the file.

Sure, it worked perfectly. The XAMPP index.php file makes a redirect to the \xampp\htdocs\xampp\ subfolder.

asaf wrote:I tried a test file called test.php the same path - and it gave me the same Eror message.

Make a new test.php file with the following code
Code: Select all
<?php
$var = "Hello World!";
echo $var;
?>

and save it in C:\xampp\htdocs\
Now you can request it with the URL http://localhost/test.php and should echo out Hello World.

asaf wrote:is it possible that my antivirus or firewall preventing xampp to operate?

No, it is all about requesting the file the right way. Everything which starts with file:// in your browser doesn't work, because then your browser will load the file directly via from your harddisk and will not request it through your Webserver.

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: 11926
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: Eror browser displays PHP as a plain text (showing the c

Postby asaf » 06. May 2012 12:00

don't know who you are but I love you.
thnx alot!
thnx,
asaf
asaf
 
Posts: 5
Joined: 06. May 2012 01:00
Operating System: win7

Re: Eror browser displays PHP as a plain text (showing the c

Postby Altrea » 06. May 2012 12:11

so your issue is solved?
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: 11926
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: Eror browser displays PHP as a plain text (showing the c

Postby asaf » 06. May 2012 12:25

yes, the issue of me being an idiot was solved, for now..
;-)
thnx,
asaf
asaf
 
Posts: 5
Joined: 06. May 2012 01:00
Operating System: win7

Re: Eror browser displays PHP as a plain text (showing the c

Postby Altrea » 06. May 2012 12:26

Great :D
I have marked your topic as solved.

I wish you all the best with XAMPP and all that stuff 8)
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: 11926
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: [solved]Eror browser displays PHP as a plain text

Postby Redric » 26. October 2012 21:38

Altrea, thank you for the advice!
Redric
 
Posts: 1
Joined: 26. October 2012 21:36
Operating System: MS W7


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 82 guests