By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,611 Members | 1,642 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,611 IT Pros & Developers. It's quick & easy.

what wrong with this PHP script ?

P: n/a
Hi there

I've created abd uploaded this basic PHP script:

<html>
<head>
<title>PHP Test</title>
</head>
<body>
<H1 align="center">
<?php print("Hello world!"); ?>
</H1>
</body>
</html>

But when I go to my browser and display the page:
http://members.lycos.co.uk/eightbitfanatics/test.php

it come up with the source code.

any ideas ?

Lee
Jul 16 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Lee Redeem wrote:
Hi there

I've created abd uploaded this basic PHP script:

<html>
<head>
<title>PHP Test</title>
</head>
<body>
<H1 align="center">
<?php print("Hello world!"); ?>
</H1>
</body>
</html>

But when I go to my browser and display the page:
http://members.lycos.co.uk/eightbitfanatics/test.php

it come up with the source code.


Nothing's wrong with the script, it's the server. It doesn't look like
it is set up for parsing a .php file. This means either the webmaster
has set a different extension to be used (like .phtml) or PHP is not
enabled on the server. I'd try to use the phtml extension if you know
you have PHP capeabilities on the server.

--
Justin Koivisto - sp**@koivi.com
PHP POSTERS: Please use comp.lang.php for PHP related questions,
alt.php* groups are not recommended.

Jul 16 '05 #2

P: n/a
On Fri, 15 Aug 2003 14:07:57 GMT, Justin Koivisto <sp**@koivi.com>
wrote:
Lee Redeem wrote:
Hi there

I've created abd uploaded this basic PHP script:

<html>
<head>
<title>PHP Test</title>
</head>
<body>
<H1 align="center">
<?php print("Hello world!"); ?>
</H1>
</body>
</html>

But when I go to my browser and display the page:
http://members.lycos.co.uk/eightbitfanatics/test.php

it come up with the source code.


Nothing's wrong with the script, it's the server. It doesn't look like
it is set up for parsing a .php file. This means either the webmaster
has set a different extension to be used (like .phtml) or PHP is not
enabled on the server. I'd try to use the phtml extension if you know
you have PHP capeabilities on the server.


It's not that. Whatever editor/method of upload the OP has used has
converted < to &lt; and > to &gt; etc.

If it was as simple as the server not parsing php, the <html>, <head>,
etc would not be visible.

I'd also suggest finding a decent host. Lycos has bloated the OP's
original code to 13 times its size!

--
David (please modify address to david@ before replying!)
Jul 16 '05 #3

P: n/a
"Lee Redeem" <le******@lycos.co.uk> wrote in message
news:88**************************@posting.google.c om...
Hi there

I've created abd uploaded this basic PHP script:

<html>
<head>
<title>PHP Test</title>
</head>
<body>
<H1 align="center">
<?php print("Hello world!"); ?>
</H1>
</body>
</html>

But when I go to my browser and display the page:
http://members.lycos.co.uk/eightbitfanatics/test.php

it come up with the source code.


Your server is not supporting PHP, or is not set to parse .php files by
default. contact your server administrator.

HTH

--
Suni
Jul 16 '05 #4

P: n/a
David Mackenzie <dc*@tarbrax.freeserve.co.uk> wrote in message
If it was as simple as the server not parsing php, the <html>, <head>,
etc would not be visible.


?? Where do you get that theory? True only if the server is set to
only send files of a certain extensions or explicitly doesn't allow
..php files to be sent.
you could just as well rename the script "doody.fart"... it won't get
parsed but it will send the file as plain text.
Jul 16 '05 #5

P: n/a
{{Date: 15 Aug 2003 07:03:31 -0700
From: le******@lycos.co.uk (Lee Redeem)
But when I go to my browser and display the page:
http://members.lycos.co.uk/eightbitfanatics/test.php
it come up with the source code.}}

I clicked on that link and it seems to work fine, so I guess you found
the problem and fixed it. What was the solution? I'm having the same
problem with my first attempt at a php hello program:
http://www.rawbw.com/~rem/h.php

One possible clue is the following system message:
2001/06/11: PHP is available. To setup for an extension in your
site, use an .htaccess and do for example: AddHandler php4-script .php
Is that something I need to do before my hello world script will work?
If so, what exactly do I need to do. It's cryptic for a total beginner.
If not, what *do* I need to do to get h.php to be processed instead of
treated as .txt?

For comparison, these all work:
http://www.rawbw.com/~rem/h.txt
http://www.rawbw.com/~rem/h.html
http://www.rawbw.com/~rem/cgi-bin/h-sh.cgi
http://www.rawbw.com/~rem/cgi-bin/h-cmucl.cgi
http://www.rawbw.com/~rem/cgi-bin/h-perl.cgi
(First one trivial just for hack value of course, second one in a
trivial way, no actual html in the file, but still it "works". I've
been programming HTML since about 1995, and CGI/sh/cmucl since
2001.Jan, but I thought I'd install a simple hello world file in each
of those to accompany the others I'm doing in other languages I haven't
done before, and I tried the CGI/perl one tonight for the first time
and it worked the first time after I did the right chmod.)

Jul 16 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.