# PHP Code Displayed In Browser



## joshuambenhase (Jun 8, 2014)

I cannot figure out what I am doing wrong here.  Something is not setup on my web server correctly and I don't know what.  I used this short page to test and it keeps showing the code in the browser.


```
<!DOCTYPE html>
<html>

<body>

<?php phpinfo(); ?>

</body>

</html>
```

Any suggestions?


----------



## bsdkeith (Jun 8, 2014)

Take a look at someone elses. Go to a web page, right click, & 'view source', should show how it is made up. Hope that helps.


----------



## wblock@ (Jun 8, 2014)

That's a common problem: http://stackoverflow.com/questions/...-executed-i-can-see-it-on-source-code-of-page.  Answer #3 is often the problem:

```
AddType application/x-httpd-php .php
```


----------



## joshuambenhase (Jun 8, 2014)

That is already in my httpd.conf file, does it need to be in a certain place for it to work?  I am sorry, I am a newbie.


----------



## joshuambenhase (Jun 8, 2014)

I've attached my httpd.conf file, is there something wrong in it?


----------



## wblock@ (Jun 8, 2014)

It's in an attachment no one can easily read.  Please put it on http://pastebin.com/.

Also, please begin to use the formatting instructions in the numerous PMs you've received.


----------



## joshuambenhase (Jun 8, 2014)

People can't read a very common text file attachment?  While would I do a URL?


----------



## ljboiler (Jun 8, 2014)

> I've attached my httpd.conf file, is there something wrong in it?



Well, I see two <FilesMatch> directives that match the same pattern but set different handlers.  My guess is that the last one in wins...


----------



## joshuambenhase (Jun 8, 2014)

Unbelievable 'ljboiler'!  You are the man!  I uncommented the second set of <FilesMatch> and Boom, that worked and the php that I connected to my database also worked!  Life saver man!  Appreciate it.  I was following a website and it said to put both of those in, so I don't know why it would say that if only one was needed.  Thanks again!


----------



## wblock@ (Jun 8, 2014)

joshuambenhase said:
			
		

> People can't read a very common text file attachment?  While would I do a URL?



It's readable, but requires downloading and opening.  On a website, it only requires a click.  Why would you do that?  Two reasons: making it easier for people to read encourages people to read it and possibly provide answers, and courtesy.

The same goes for formatting your posts.


----------

