# php5 problem



## madjack1 (Jun 21, 2012)

I'm running Freebsd 9.1 FreeBSD and have Apache 2.2? installed and it's working correctly as I'm getting the "It Works" page. My hosts file seems to be correctly configured and as far as I can tell the httpd.conf file seems to be configured correctly. The problem I'm having is with PHP 5.4.3. I have done a [cmd=]make config[/cmd] and ticked the apache module and have done [cmd=]make install clean[/cmd] Afterwards I added 

```
<IfModule mod_php5.c>
        DirectoryIndex index.php index.html
    </IfModule>
    <IfModule mod_php5.c>
        AddType application/x-httpd-php .php
        AddType application/x-httpd-php-source .phps
        AddType application/x-httpd-php .php .htm .html
    </IfModule>
```
to the httpd.conf file. I've tested that PHP is running by entering `php -r 'print_r(phpinfo());'` into a terminal and all of the phpinfo comes up but when I run a test.php page in a browser which has the following command 
	
	



```
<?PHP phpinfo(); ?>
```
 it doesn't run as a script it only opens a page which shows the command. It acts like the apache module is not loaded or not running. The httpd.conf file shows


```
LoadModule php5_module        libexec/apache22/libphp5.so
```

and although the libphp5.so was originally installed to /usr/local/libexec/apache22 I both copied it to /libexe/apache22/ and created a symbolic link to that directory as I wasn't sure whether the actual moving of the file would break something. I remember having some kind of issue about a year ago with Acroreader and the correct method turned out to be to make the link instead of copying or moving the .so file. Anyway I don't remember all the details of that one and that's been solved. Does anyone know what my PHP problem could be?

Thanks in advance.


----------



## DutchDaemon (Jun 21, 2012)

The module paths in httpd.conf are relative to /usr/local/ so the symlink is pointless.

You should probably check your 
	
	



```
<IfModule dir_module>
```
 as a forum search likely would have revealed.


----------



## jnbek (Jun 21, 2012)

Also php is a case sensitive language, your opening tag [CMD="<?PHP"]<?PHP[/CMD] should probably read [CMD="<?php"]<?php[/CMD] instead.


----------



## madjack1 (Jun 21, 2012)

Thanks guys that was it. I've already tried about a half a dozen different <IfModule dir_module> configurations that I've gotten from different parts of the forums and other sites but since I have no idea how it works I had no idea whether or not it was correct or not. After the heads up a search revealed 


```
<IfModule dir_module>
  DirectoryIndex index.html
  DirectoryIndex index.htm
 <IfModule php5_module>
  DirectoryIndex index.php
 </IfModule>
</IfModule>
```
as the correct entries and after changing the case in the test.php file it works. I don't see any way to mark this as solved in the reply box.


----------

