need help with PHP on Apache

Issues related to applications and software problems
Post Reply
sciencedicas
Posts: 12
Joined: 2014/07/21 15:01:48

need help with PHP on Apache

Post by sciencedicas » 2015/01/20 13:29:40

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>

User avatar
TrevorH
Forum Moderator
Posts: 23876
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: need help with PHP on Apache

Post by TrevorH » 2015/01/20 13:34:33

Your index.html would need to be index.php so that the php interpreter is invoked.
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

sciencedicas
Posts: 12
Joined: 2014/07/21 15:01:48

Re: need help with PHP on Apache

Post by sciencedicas » 2015/01/20 14:04:41

thank you TrevorH
that solved my issue.

Post Reply