# Unable to get php5 working on FreeBSD 8.2...help needed



## thecoffeeguy (Apr 21, 2011)

So I am working on setting up a IDS box with Snort and BASE. I have Snort running the way I want with MySQL on the backend and all is working correctly. I am trying to now build BASE for a web interface to look at Snort alerts. I have built everything through ports, but having a very odd issue.

Apache is working correctly, but I dont think PHP is. Every time I try to load up BASE, I just see a list of the .php files in the directory. When I try and see if php is working correctly with a simple test.php:


```
<?
phpinfo();
?>
```

I load that up in my browser and nothing comes back. I added the following to the bottom of my httpd.conf file:


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

I installed apache2.2.17_2
PHP5-5.36

Any suggestions on what I am missing?

Thanks.


----------



## thecoffeeguy (Apr 21, 2011)

Alright. I did figure out that PHP is working ok. M script was incorrect. I modified it to:


```
<?php
phpinfo();
?>
```

Next trick is, why, when I try and open up the URL with /base after it, I just see a list of the files in that directory....


----------



## mamalos (Apr 22, 2011)

In order not to see the directory listing in any subfolder of your DocumentRoot, remove *Indexes* from your *Options* directive in your httpd.conf. Now, in order to show a web page in some subfolder, you have add an index.html or index.php file in that folder. For index.php to work, you'll have to update your *DirectoryIndex* directive of your httpd.conf to include index.php (or whatever filename you wish). Don't forget to restart apache after making your changes.


----------



## thecoffeeguy (Apr 26, 2011)

Figured it out.
Thx for the help.


----------



## DutchDaemon (Apr 26, 2011)

Please post your solution so others can learn from it.


----------



## thecoffeeguy (Apr 26, 2011)

DutchDaemon said:
			
		

> Please post your solution so others can learn from it.



Sure.

What I ended up doing was cleaning up apache and PHP port installs and reinstalling them.

This time, I made sure when I was in both directores, I did 


```
make config
```

to specify the options I needed for the builds.

My guess is that I missed something initially during the port build. What thing I have noticed is that, when I use the ports tree, I usually don't like to download ALL the ports available because they don't fit my needs. However, sometimes there are these odd dependencies that a port will need. With that, I went back into my ports-supfile and basically downloaded all the ports.

Once that was done, I rebuilt the ports and that seemed to fix it.

HTH.

TCG


----------



## Carpetsmoker (Apr 29, 2011)

> Alright. I did figure out that PHP is working ok. M script was incorrect. I modified it to:



In PHP 5.3 the default for _short_open_tag_ changed from On to Off.

In PHP's core it's still On by default, but it's set to Off in the default php.ini config.


----------

