Page 1 of 1

PHP code fails

Posted: Thu Nov 25, 2004 11:28 pm
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]

Posted: Fri Nov 26, 2004 3:04 am
by Archy
The obvious question is: do you have PHP enabled on your server?

Or try:

Code: Select all

echo(date('j....'));

Posted: Fri Nov 26, 2004 3:17 am
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 :(

Posted: Fri Nov 26, 2004 3:25 am
by phpScott
do

Code: Select all

<?php
phpinfo();
?>
what do you get?

Posted: Fri Nov 26, 2004 3:31 am
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 :'(

Posted: Fri Nov 26, 2004 3:41 am
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.

Posted: Fri Nov 26, 2004 3:46 am
by PhantomsHorridC
Thats where i downloaded if from ...:(

Posted: Fri Nov 26, 2004 10:41 am
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....

Posted: Fri Nov 26, 2004 11:34 am
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.

Posted: Sat Nov 27, 2004 5:57 am
by PhantomsHorridC
it is test.php

but thanx for trying

PHP code fails

Posted: Sun Jan 02, 2005 3:26 pm
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