String PHP doesn't work inside HTML file

Problems with the Windows version of XAMPP, questions, comments, and anything related.

String PHP doesn't work inside HTML file

Postby rtc_brz » 28. January 2014 20:26

Hi,
I have the following problem, if someone can help I will appreciate.
HTML code: (testphp.html)
<html>
<head>Test info PHP</head>
<body>
<?php
phpinfo();
?>
</body>
</html>

Result : Test info PHP (only)

Something PHP code (testphp.php)
<?php
phpinfo();
?>

Result: all info about PHP instaled on XAMPP

Whats worng?
Tks
rtc_brz
 
Posts: 3
Joined: 28. January 2014 20:14
Operating System: Windows 8.1

Re: String PHP doesn't work inside HTML file

Postby russsaidwords » 28. January 2014 21:00

I believe what's happening is that Apache doesn't recognize the .html file extension as belonging on the end of a file that needs to be sent through PHP. A quick check is to replace the testphp.html filename with testphp.php
russsaidwords
 
Posts: 1
Joined: 28. January 2014 20:57
Operating System: win 7

Re: String PHP doesn't work inside HTML file

Postby rtc_brz » 28. January 2014 21:48

Thanks for the answer but Apache works good with html files, the only problem is that it don't process the string php inside html code, all others (java, js) strings are ok. When run a php file works fine, html file too but, string php inside html file( eg. <?php include("myfile.php") ?>) doens't work.
rtc_brz
 
Posts: 3
Joined: 28. January 2014 20:14
Operating System: Windows 8.1

Re: String PHP doesn't work inside HTML file

Postby Altrea » 28. January 2014 22:00

russsaidwords already said everything important. By default Apache don't send .html files through the php interpreter.
And if you are wondering why js code is working, think about what the difference is between js and php.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11933
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: String PHP doesn't work inside HTML file

Postby rtc_brz » 29. January 2014 01:42

russsaidwords and Altrea, sorry for ignorance, especially in not understanding the russsaidwords, really just changing the extension from html to php file without changing the content, worked perfectly. Thanks to you guys for the help.
rtc_brz
 
Posts: 3
Joined: 28. January 2014 20:14
Operating System: Windows 8.1


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 98 guests