lewmur Posted December 31, 2022 Share Posted December 31, 2022 I'm an 83 yr old retired computer consultant and I'm trying to write a simple program to display info from a text file. I'm running PHP8.1.2 from a Mint 21 box. I have apache2 installed and modified the apache2.conf file to change AllowOverride to All. I created the .htaccess file in the /var/www/html folder with the line AddType application/x-httpd-php81 .php .php5 .htm .html If I run the PHP code in a .php file, it works fine. But I want to change the white background to an image and the only way I see to do that is in HTML. But when I put the PHP code in the HTML file, it just displays the code. What am I doing wrong???? Quote Link to comment Share on other sites More sharing options...
Solution Barand Posted December 31, 2022 Solution Share Posted December 31, 2022 PHP code must be in a .php file to be executed (with a standard configuration) However a .php file does not need to contain any php code, it can be html only. So any html you can do in an .html file should work in a .php file. Define the background image in your css - it should work the same in either. Quote Link to comment Share on other sites More sharing options...
lewmur Posted December 31, 2022 Author Share Posted December 31, 2022 4 minutes ago, Barand said: PHP code must be in a .php file to be executed (with a standard configuration) However a .php file does not need to contain any php code, it can be html only. So any html you can do in an .html file should work in a .php file. Define the background image in your css - it should work the same in either. So simple!!! I just save the .html file as a .php and it works!! Thanks!! Quote Link to comment Share on other sites More sharing options...
json_encoded Posted January 1, 2023 Share Posted January 1, 2023 Raise your hand if you remember being that new 🙋♂️ 🙋♂️ 🙋♂️ 🙋♂️ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.