When I want to execute a php file it's displayed as text in my browser.
I have a VPS at Hostinger I installed Ubuntu 18.04 with Webmin and LAMP(installed automatically).
I checked the installation see below.
apache2 - v
and php -v
gives me: Apache/2.4.29
and PHP 7.2.24-0ubuntu0.18.04.6
So everything seem to be installed correctly.
My default folder is /var/www/html/ I do not us short tag in my code.
I try to lunch a file called phpinfo.php with content:
<?php
phpinfo();
?>
And plain text appear on the page.
If the file begin with html code it's correctly rendered, even with a .php file. But the php part is not executed. e.g:
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<h1>Hello</h1>
</body>
</html>
<?php
phpinfo();
?>
Render : Hello
But
<?php
phpinfo();
?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<h1>Hello</h1>
</body>
</html>
Render the code as plain text.