PHP code fails

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
PhantomsHorridC
Forum Newbie
Posts: 5
Joined: Thu Nov 25, 2004 11:21 pm

PHP code fails

Post by PhantomsHorridC »

patrikG | Help us, help you. Please use

Code: Select all

and

Code: Select all

tags where approriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
OK i'm probaby in the wrong section if so please let me know where to post this...

Ok i have a problem, with my PHP, i was using ColdFusion and Dreamweaver, but when ever i tried to run any PHP script it wouldn't display, i then tried IIS but that prompts me to download the PHP file, i don't really do much/any PHP code but i am now confused why i can't run some thing as simple as :~

Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
	<title>Test</title>
</head>
<body>
Today's date is: <?php echo date('j F Y'); ?>
</body>
</html>
all i get is:~

Today's date is:
patrikG | Help us, help you. Please use

Code: Select all

and

Code: Select all

tags where approriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Archy
Forum Contributor
Posts: 129
Joined: Fri Jun 18, 2004 2:25 pm
Location: USA

Post by Archy »

The obvious question is: do you have PHP enabled on your server?

Or try:

Code: Select all

echo(date('j....'));
PhantomsHorridC
Forum Newbie
Posts: 5
Joined: Thu Nov 25, 2004 11:21 pm

Post by PhantomsHorridC »

<?php echo(date('j....')); ?>

also gave no result,

i installed PHP (php-5.0.2-installer.exe) and run a test "PHP -i" and it would seam ok, but still no results :(
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

Post by phpScott »

do

Code: Select all

<?php
phpinfo();
?>
what do you get?
PhantomsHorridC
Forum Newbie
Posts: 5
Joined: Thu Nov 25, 2004 11:21 pm

Post by PhantomsHorridC »

Blank page,

i guess that means the PHP isn't setup correctly,

any ideas on my next move ?
i looked in the coldfusion server admin thing, and couldn't see anything to do with PHP :'(
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

Post by phpScott »

I haven't played IIS so I can't be much help but did you download the php files from http://www.php.net/downloads.php there is even a msi version that should do the trick for you if you haven't.
PhantomsHorridC
Forum Newbie
Posts: 5
Joined: Thu Nov 25, 2004 11:21 pm

Post by PhantomsHorridC »

Thats where i downloaded if from ...:(
User avatar
Bill H
DevNet Resident
Posts: 1136
Joined: Sat Jun 01, 2002 10:16 am
Location: San Diego CA
Contact:

Post by Bill H »

Maybe a dumb question, but what is the name of the test file?
If it is "test.html" it won't run the php code.
if it is "test.php" it will.
I may be off base with the suggestion, but....
raging radish
Forum Commoner
Posts: 32
Joined: Sun Nov 14, 2004 3:02 pm
Location: Toronto

Post by raging radish »

Not sure how it works with IIS but you should probably be accessing the file through localhost for php to recognize what it is - at least that how it works on my machine. Using the browser's File | Open dialog to open the file won't work.

Try something like http://127.0.0.1/myfile.php or http://localhost/myfile.php with the phpinfo() script.

If IIS/php are configured properly, it should load up.
PhantomsHorridC
Forum Newbie
Posts: 5
Joined: Thu Nov 25, 2004 11:21 pm

Post by PhantomsHorridC »

it is test.php

but thanx for trying
shirokuma
Forum Newbie
Posts: 8
Joined: Fri Jun 13, 2003 4:45 am
Location: Japan

PHP code fails

Post by shirokuma »

PhantomHorridC,

It has been a while since the last post to this thread so you may have already found a solution.

I think your problem is not PHP. I think it is how you have IIS configured. IIS sees the .php file as an unknown file type and instead of invoking the PHP engine treats it as an unknown file type which usually means 'download the file'. Check your file associations withing IIS.

Shirokuma
Post Reply