Page 1 of 1

[solved]Eror browser displays PHP as a plain text

PostPosted: 06. May 2012 01:07
by asaf
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...

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

PostPosted: 06. May 2012 01:10
by Altrea
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

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

PostPosted: 06. May 2012 01:39
by asaf
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

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

PostPosted: 06. May 2012 04:39
by hackattack142
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

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

PostPosted: 06. May 2012 10:17
by asaf
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?

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

PostPosted: 06. May 2012 11:34
by Altrea
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

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

PostPosted: 06. May 2012 12:00
by asaf
don't know who you are but I love you.
thnx alot!

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

PostPosted: 06. May 2012 12:11
by Altrea
so your issue is solved?

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

PostPosted: 06. May 2012 12:25
by asaf
yes, the issue of me being an idiot was solved, for now..
;-)

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

PostPosted: 06. May 2012 12:26
by Altrea
Great :D
I have marked your topic as solved.

I wish you all the best with XAMPP and all that stuff 8)

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

PostPosted: 26. October 2012 21:38
by Redric
Altrea, thank you for the advice!