R
R
rechmp2015-01-23 13:23:22
HTML
rechmp, 2015-01-23 13:23:22

Why doesn't php code work in html?

I have a forum, on the phpbb engine. There is a banner image on the forum, described in the file /www/myforum.com/styles/mytheme/template/overall_header.html
I wrote a php code that randomly selects an image from the database. This code in php files works fine, but in html files like <?php><?> it seems to be ignored.
Why, even <?php>echo 123;<?> is not displayed in test.html.
Tell me how to get out of this situation and make the code work?
Thank you.
UPD: Thank you all, I figured it out myself. I solved it by turning on the checkbox in the admin panel and using the tag

<!— PHP —>
echo"test";
<!— ENDPHP —>

Answer the question

In order to leave comments, you need to log in

4 answer(s)
E
exactly the most, 2015-10-23
@rechmp

For those who have just maybe installed Linux and configured apache2 with virtual hosts, you can use the command naturally in the terminal!
echo display
' AddType application/x-httpd-php .php .html ' what needs to be displayed for correct work of php code in html
sudo tee -a how to do it
/etc/apache2/ httpd.conf where to do it

Y
yanchumak, 2015-01-23
@yanchumak

in order for PHP code to work in HTML, you need to configure Apache
www.greenlight5.com/proph1.htm

D
Denis Nikolaev, 2015-01-23
@SamFlynn

Looking at your code, I had an idea how to slightly promote my forum. =)

S
Sergey Karvasarny, 2015-01-23
@megapihar6

test.html and will not output only in .php file will work in .html does not work! + what was written above (Or maybe so?
<?php echo 123; ?>)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question