Page 1 of 1

PHP not interpreted (Win7) 1.7.7 [SOLVED]

PostPosted: 07. December 2011 11:14
by Ivo21
I am new to XAMPP and web programming.
I installed XAMPP 1.7.7 on Windows 7.
On the status page, MySQL, PHP, HTTPS (SSL), CGI and SSI are all activated.
I tried my first PHP script, the easiest, by writing this code

<html>
<head>
<title>My First PHP Page</title>
</head>
</body>
<?php print('Hello world'); ?>
</body>
</html>

I opened the script file in Firefox 8.01 but PHP is not interpreted. I get a blank page (though, with the right header "My First PHP Page").
Any suggestion?
Thanks for any help, Ivo

Re: PHP not interpreted

PostPosted: 07. December 2011 11:16
by Sharley
What did you name the file and where did you put the file in XAMPP?

What did you type in the browser?

Re: PHP not interpreted

PostPosted: 07. December 2011 11:28
by Ivo21
My file is called first.php and is located on c:\server (on c:\server\xampp I installed XAMPP).
In Firefox I open it through "File - Open File" then selecting it. The URL shown is file:///C:/server/first.php

Re: PHP not interpreted

PostPosted: 07. December 2011 11:46
by Sharley
Your files go in the C:\server\xampp\htdocs folder (DocumentRoot or the web root it is often called).

The file name first.php is correct.

The first.php file needs to be parsed by the Apache server, so make sure Apache and MySQL are both running and then type this in your browser:
http://localhost/first.php
You should then see your file's php content.

To test your XAMPP installation type:
http://localhost


New users can find self help by reading these first:
readme_en.txt file in the xampp folder.
http://www.apachefriends.org/en/xampp-windows.html
http://www.apachefriends.org/en/faq-xampp-windows.html

Some useful reading that may help you help us to find suitable solutions:
viewtopic.php?f=16&t=48331
viewtopic.php?f=16&t=32670

Re: PHP not interpreted

PostPosted: 07. December 2011 12:04
by Ivo21
It works. I tried even before to put the first.php file in the htdocs folder but I did access it by opening a file in Firefox instead of localhost so it did not work. Thanks a lot.

Re: PHP not interpreted

PostPosted: 07. December 2011 12:05
by Sharley
You're welcome and thanks for the feedback. 8)

Best wishes. :)