Re: why php echo does not show up in HTML? [message #181631 is a reply to message #181613] |
Fri, 24 May 2013 13:35 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma:
|
Senior Member |
|
|
On 5/24/2013 4:08 AM, steve nospam wrote:
> newbie.
>
> could someone explain why this does not work?
>
> <!DOCTYPE html>
> <html>
> <body>
> <p>before
>
> <?php echo "do you see this?"; ?>
>
> <p>after
> </body>
> </html>
>
> I spend 2 hrs and tried everything and read many things, but message
> in echo does not show on the browser. I upload this to the web server.
> I also have local web server running. Both support php. I see no error
> in the access log file and no error in the php error log file. So the
> page is bring loaded OK by the web server. But I do not see the echo.
> What Ami doing wrong?
>
> cheers,
> steve
>
Look at the source in your browser. You will see the message, including
the <?php echo...
The web server will not (by default) pass pages to the PHP interpreter
unless they have a .php extension. You can include PHP code in html
code, but need to parse them as PHP.
If you're using Apache, you could change the Apache configuration to
pass all pages to the PHP interpreter, but this can cause extra load on
the server due to unnecessarily parsing non-PHP pages as PHP code. It
is also not portable and will not run on hosts where this type of
configuration is not allowed.
Your best bet is to simply change the files you need to include PHP code
in to a .php extension and fix the links on your site. For external
links, configure your web server to do a permanent redirect from the old
page to the new (see your web server configuration for more information
on how to do this).
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|