.PHP file not opening

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
KostaKondra
Forum Newbie
Posts: 16
Joined: Thu Nov 19, 2009 8:26 am

.PHP file not opening

Post by KostaKondra »

I made a file (index.php) but when I open it with Google Chrome (or Mozilla doesn't matter) it doesn't display it! It just downloads it like it's a normal file. This is so crazy. It makes me so mad.

Does anyone have any idea what's wrong? I don't think it has anything to do with the code as it's just a tester but I will post it up here. This is the most ridiculous thing that's ever happened to me.

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Today&rsquo;s Date</title>
<meta http-equiv="content-type"
content="text/html; charset=utf-8"/>
</head>
<body>
<p>Today&rsquo;s date (according to this web server) is
<?php
echo date('l, F dS Y.');
?>
</p>
</body>
</html>
KostaKondra
Forum Newbie
Posts: 16
Joined: Thu Nov 19, 2009 8:26 am

Re: .PHP file not opening

Post by KostaKondra »

Hello!?
KostaKondra
Forum Newbie
Posts: 16
Joined: Thu Nov 19, 2009 8:26 am

Re: .PHP file not opening

Post by KostaKondra »

Hi Kosta,

The answer is quite easy, you are attempting to open the file directly in Windows Explorer however Apache won't let that slide. Instead do it their way and type in the following:

http://localhost/index.php

Not a problem.
ibom
Forum Newbie
Posts: 18
Joined: Sat Nov 28, 2009 3:05 am

Re: .PHP file not opening

Post by ibom »

Hey..

I think that you are using PHP date function inside the Html. The Html file don't read php codes inside.. That way you are getting a blank page.. Tray to remove the php date. save it. And than open the html file in normal browser.
Post Reply