How do I 'activate' mod_php5?

Kevin D. Kinsey, DaleCo, S.P. kdk at daleco.biz
Mon Nov 15 12:32:56 PST 2004


Kjell Midtseter wrote:

>On Monday, 15 November 2004 at 10:20:32 -0600, Kevin D. Kinsey, DaleCo, S.P. wrote:
>  
>
>>Kjell Midtseter wrote:
>>
>>    
>>
>>>After installing lang/php4-extensions with apache13, 
>>>I can start using embedded php in my web pages right away. 
>>>When installing lang/php5-extensions, the embedded php 
>>>is passed as if it were html without being interpreted. 
>>>Any initialization required fro php5?
>>>The required modules seems to be in place in httpd.conf
>>>I get the same results when I make a new clean and cvsup'ed install from 
>>>the 5.3R CD Kjell
>>>      
>>>
>>The procedure is the same for PHP5 as it was for PHP4,
>>with no variations *that I have noticed*.
>>
>>So, the first question ... have you added/modified/created
>>the necessary AddModule, LoadModule, and AddHandler
>>(or is it AddType?) lines in your httpd.conf?
>>
>>    
>>
>What I have done is:
>1) Loaded a system from the 5.3R CD, cvsup'ed and built world etc, 
>cvsup'ed ports and upgraded. Then installed lang4-extensions/apache13
>2) Repeated 1) on a second box, but installing lang5-extensions/apache13
>3) Repeated 1) on the second box, but installing lang5-extensions/apache2
>
>Used the same options in all 3 cases. (slight diffs in the apache2 case)
>
>1) works as always. I find 
>LoadModule php4_module        libexec/apache/libphp4.so
>AddModule mod_php4.c
>in httpd.conf (No need to add anything)
>
>2) does not work. I find
>LoadModule php5_module        libexec/apache/libphp5.so
>AddModule mod_php5.c
>in httpd.conf 
>
>3) does not work. I find
>LoadModule php5_module        libexec/apache2/libphp5.so
>in httpd.conf (no AddModule) 
>
>  
>
<snipped Index options>
<snipped more of my last>

Thanks for the detailed reply.

If the issue is really that you are seeing PHP source instead
of the server "handling" the PHP code, then most likely it is
the "AddType" directive that is wrong/missing/etc.

Here is that section of httpd.conf from a working PHP4
installation:

    <IfModule mod_php3.c>
        AddType application/x-httpd-php3 .php3 .html
        AddType application/x-httpd-php3-source .php3s
    </IfModule>
    <IfModule mod_php4.c>
        AddType application/x-httpd-php .php .html .asp .php3
        AddType application/x-httpd-php-source .phps
    </IfModule>  

    In this case, we use PHP to interpret everything as
the server is low traffic and we use PHP in docs that
are saved as *.html as well (I think we added *.asp as
a jibe at M$ ....)  At the moment I've no shell at the
PHP5 box, but I must assume it's the same there.

Kevin Kinsey


More information about the freebsd-questions mailing list