Apache22 php5 What am I doing wrong?

I have recently upgraded to FreeBSD 8. I am trying to get PHP5 to work with my Apache22. I can execute the php script from the command line IE
Code:
#php test.php
and it executes correctly. I attempt to run it from a browser, any browser, and it attempts to download the file instead of execute it.

I have the following PHP related lines in my httpd.conf:

Code:
LoadModule php5_module        libexec/apache22/libphp5.so
    <IfModule mod_php3.c>
        <IfModule mod_php5.c>
            DirectoryIndex index.php index.php3 index.html
        <IfModule !mod_php4.c>
            DirectoryIndex index.php3 index.html
    <IfModule !mod_php3.c>
        <IfModule mod_php5.c>
            DirectoryIndex index.php index.html index.htm
        <IfModule !mod_php4.c>
    DirectoryIndex index.php index.html index.htm
    AddHandler application/x-httpd-php .php
    AddHandler application/x-httpd-php-source .phps

Any thoughts on why it's not working?

Thanks!
 
Did you use the package or the port to install php?

By default the apache module isn't build. That means it's not in the package. So you have to build from the port.
 
SirDice said:
Did you use the package or the port to install php?

By default the apache module isn't build. That means it's not in the package. So you have to build from the port.

I have triple verified that php 5.2.12 was installed with the "build apache module" selected. [:)]
 
This may be a stupid question, and if it is, I apologize, but do you close your [font="Courier New"]IfModule[/font]s?

Code:
LoadModule php5_module        libexec/apache22/libphp5.so
    <IfModule mod_php3.c>
        <IfModule mod_php5.c>
            DirectoryIndex index.php index.php3 index.html
        </IfModule>
        <IfModule !mod_php4.c>
            DirectoryIndex index.php3 index.html
        </IfModule>
    </IfModule>
    <IfModule !mod_php3.c>
        <IfModule mod_php5.c>
            DirectoryIndex index.php index.html index.htm
        </IfModule>
        <IfModule !mod_php4.c>
        </IfModule>
    </IfModule>
    DirectoryIndex index.php index.html index.htm
    AddHandler application/x-httpd-php .php
    AddHandler application/x-httpd-php-source .phps
 
Anything in the apache error files?

Set up your PHP.ini to write an error file. Restart Apache and see if that logs anything.
 
This is the only error:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20060613-debug/session.so' - Cannot open "/usr/local/lib/php/20060613-debug/session.so" in Unknown on line 0
 
Well the only other thing the comes to mind is maybe in your PHP.ini you have

Code:
short_open_tag = Off

But you php files start with
Code:
 <?

instead of
Code:
<?php

which would cause the file to try and download or just display depending on the browser settings.
 
Weird. I had the test.php in the root directory of my website and it didn't work. I put it in a subdirectory and it works. In the httpd.conf, I have /usr/local/www/website/* and not just the top level directory, I guess. Well, thanks for looking for me guys! I do appreciate it!
 
Back
Top