Welcome to WebmasterWorld Guest from 54.167.0.111

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

<?php phpinfo(); ?> returns blank when embedded in .html

     

teasers

12:54 pm on Aug 3, 2010 (gmt 0)

10+ Year Member



Hello,

I am configuring a new server with Lighttpd, PHP5 & mysql as on this page:[howtoforge.com ]

Well, i am noob on those things, the problem is that when I test php via a simple index.php page with <?php phpinfo(); ?> in it, everything's ok. But, When I embed that into an .html file as shown below, the page returns blank.

<html>
<head>
<title>PHP Test</title>
</head>
<body>
<?php phpinfo(); ?>
</body>
</html>

what may be the reason for that? I think something is wrong.

p.s.: Using mysql_secure_installation, i have disabled remote connections. What is this for? On 'CentOS perfect setup' pages, everyone recommends setting:

mysqladmin -h server.example.com -u root password yourrootpassword

do I really have to set this?

Matthew1980

2:18 pm on Aug 3, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



Hi there teasers,

When I embed that into an .html file as shown below, the page returns blank.


It will, you need the file type to be .php otherwise the parser won't be invoked to do it's job - you can however do something with apache that tells it to use the php parser on .html files too, though I haven't done this before.

Cheers,
MRb

teasers

5:37 pm on Aug 3, 2010 (gmt 0)

10+ Year Member



thanks matthew..
So I think the above example, which puts php into html is a wrong example as performing a test -- unless 'do something with apache that tells it to use the php parser on .html files too' as you said.

rocknbil

7:08 pm on Aug 3, 2010 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



No, you can put PHP inline in HTML - you must simply name the file with a PHP extension. test.html = test.php.

Anyango

7:35 am on Aug 4, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can use .htaccess file in the directory to tell apache about that, its a 1 line command.


AddType application/x-httpd-php .html

teasers

9:08 am on Aug 4, 2010 (gmt 0)

10+ Year Member



and.. if the server is Lighttpd? Same?
thank you

coopster

11:45 am on Aug 5, 2010 (gmt 0)

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



You'll want to get familiar with the configuration directives [redmine.lighttpd.net] for that http server.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month