5

Possible Duplicate:
PHP code is not being executed (i can see it on source code of page)
web browser not processing PHP code as PHP code

I have installed XAMPP on my computer which is Windows 8 pro. I use to work with Windows 7 every time I run the index.php file on Windows 8 it shows the code on the browser IE10.

Here is what I have done:

  1. I have named the file correctly: index.php
  2. I have installed the server and saved the files inside c:/xampp/htdocs/PHP/
  3. I have used <?php ?> to open and close all PHP tags and everything else seems working fine, like, PHPMyAdmin, and the php.ini file

I don't know whats wrong and it is driving me crazy ...

Farris

7
  • 2
    is the url http://localhost ... index.php and NOT file:/// ...?? Commented Nov 5, 2012 at 22:59
  • Are you using short php tags? Like <? ? If you are that could cause problems. Commented Nov 5, 2012 at 22:59
  • @Dagon when I open the file the location is file:///C:// not localhost/ Commented Nov 5, 2012 at 23:01
  • 3
    well that's the problem. your reading the 'raw' file with the browser, you need to parse it through the webserver (with php). type (copy paste) http://localhost/index.php or maybe its http://localhost/PHP/index.php in the browser Commented Nov 5, 2012 at 23:02
  • @smottt I am using the full <?php tags Commented Nov 5, 2012 at 23:03

1 Answer 1

16

The problem is you're not parsing the file via the web server, but accessing it directly.

you need to use the url:

http://localhost/index.php 

or maybe (based on your path above) its

http://localhost/PHP/index.php

in the browser

Sign up to request clarification or add additional context in comments.

2 Comments

usually trought httpd.conf can configure all needed directories to be accessible via browser. By default it's only one document root which will execute PHP code
yup, but lets get the basics working first ;-)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.