php5 support problem with apache

I'm trying to open a php page on my server and it opens as code.

I don't know what I'm doing wrong, I've installed php5, apache22, php5-extensions, where do I start to figure out this problem?

Thanks
 
This is just an example to get you working:

Code:
<IfModule dir_module>
    DirectoryIndex index.html index.php index.htm
</IfModule>

.....

AddType application/x-httpd-php .php
 
kr651129 said:
... I've done that already after following the handbook ...

The handbook suggests to add/check for a module that does not exist with that name on FreeBSD 8/9 systems.

Code:
AddModule mod_php5.c
<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
</IfModule>

The following command exhibits this to being erroneous:

# apachectl configtest

Perhaps mod_php5.c is something left over from an installation guide for ancient systems. Anyway, this is wrong, and so remove the AddModule directive, and instead place the DirectoryIndex/AddType directives into /usr/local/etc/apache22/httpd.conf exactly like gkontos suggested.

Best regards

Rolf
 
Thanks for the help everyone, maybe I'm missing something? I did exactly what you said rolf and my php pages are still showing up as code?
 
kr651129 said:
Thanks for the help everyone, maybe I'm missing something? I did exactly what you said rolf and my php pages are still showing up as code?

Post your httpd.conf.
 
Are you enclosing the php like this:
Code:
<?php

?>

and not like this:
Code:
<?

?>

Depending on the php configuration (short open tags) the latter may or may not be supported.
 
Your httpd.conf is missing the following directive:

Code:
LoadModule php5_module        libexec/apache22/libphp5.so

This has been also mentioned in the handbook and it should have been added automatically when installing php5 from the ports.

Perhaps, you might want to tell your story again, but now starting with it a little bit more back in the past, so we have the chance to pick up a little bit more from the history, and don't have to imagine things only from the last millisecond - it does not work.
 
Thanks rolf, still not working though. Here's a little more back story...

Well I'm installing drupal for a site I'm making on my home server, I installed www/apache22 and php5 from the ports and then I downloaded Drupal from the website even though it was in the ports. I haven't really done much other than create my sql database for the site, I had some problems with pcre but I ended upgrading it to solve the library problem I was having. I then removed drupal 7 and tried to install it from the ports just in the off chance it was something I had done wrong, but it wasn't same result except I found an error in the port from OH's suggestion (the php tag wasn't closed at the end). I closed it and it didn't make a difference. So now whenever I try to go to localhost/drupal7/install.php in chrome, firefox, or the browser on my phone it just downloads the php file and it won't display it like it should.
 
Run the following command:
# cd /usr/ports/lang/php5; make config
Make sure that the option "Build Apache module" is checked. If not, then check the option and select OK, then run the following:
# make deinstall install clean.

PS: don't forget to restart apache, and perhaps clean the browsers cache
 
Ha! Rolf, you solved it, the build apache module was already compiled, this time around I enabled AP2FILTER and it worked!
 
Back
Top