Page 1 of 1

need help with PHP on Apache

Posted: 2015/01/20 13:29:40
by sciencedicas
I'm sorry if I am an idiot for asking this question.
but I don't seem to be able to make php interpreter work on Centos7.

I've installed apache with yum install httpd
I've installed php with : yum install php php-devel

basic Apache is working well,

I create a VirtualHost wih a simple html and its working fine.

but when I add the php statement ( <?php echo ... ?>) only the html is showing, I done lots of research and it seems like it should be working.

here is my index.html, which is not showing or processing php code.
what can I do to fix this ? thank you

<!-- DOCTYPE html -->
<html lang='en'>
<head>
<meta charset="UTF-8" />
<title>
My First site
</title>
<link rel="stylesheet" type="text/css" HREF="main.css" />
</head>
<body>

<h1>
HTML Document Structure
</h1>
<p>
This is a simple HTML document.
<?php $var=1 ;
echo $var; ?>
</p>

</body>
</html>

Re: need help with PHP on Apache

Posted: 2015/01/20 13:34:33
by TrevorH
Your index.html would need to be index.php so that the php interpreter is invoked.

Re: need help with PHP on Apache

Posted: 2015/01/20 14:04:41
by sciencedicas
thank you TrevorH
that solved my issue.