homepage Welcome to WebmasterWorld Guest from 23.22.2.150
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

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

10+ Year Member



 
Msg#: 4181116 posted 12:54 pm on Aug 3, 2010 (gmt 0)

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

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 4181116 posted 2:18 pm on Aug 3, 2010 (gmt 0)

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

10+ Year Member



 
Msg#: 4181116 posted 5:37 pm on Aug 3, 2010 (gmt 0)

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

WebmasterWorld Senior Member rocknbil us a WebmasterWorld Top Contributor of All Time 5+ Year Member



 
Msg#: 4181116 posted 7:08 pm on Aug 3, 2010 (gmt 0)

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

Anyango

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 4181116 posted 7:35 am on Aug 4, 2010 (gmt 0)

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

10+ Year Member



 
Msg#: 4181116 posted 9:08 am on Aug 4, 2010 (gmt 0)

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

coopster

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



 
Msg#: 4181116 posted 11:45 am on Aug 5, 2010 (gmt 0)

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved