Apache, php?

Ivan Carey ivan at careytech.com.au
Thu Jun 21 07:46:11 UTC 2007


Jack Barnett wrote:
> Ivan Carey wrote:
>> Jack Barnett wrote:
>>> FreeBSD 6.2
>>> Apache 1.3.37 (from ports)
>>> php 5.2.3 (from ports)
>>>
>>> on the command line doing `php index.php` works.
>>> But if I use it though a web browser it just displays the php code.
>>>
>>> I installed it like this (extensions to)
>>> http://www.mydigitallife.info/2006/04/14/installing-web-server-in-freebsd-60-with-apache-22-mysql-50-and-php-5-part-5/ 
>>>
>>>
>>> The only difference is that I'm using 1.3 and not 2.x of Apache.
>>>
>>> Apache config below
>>> Installing 2.x isn't an option yet (test server, still need 1.3)
>>>
>>>    fire2# grep -i php *
>>>    httpd.conf:AddType application/x-httpd-php .php
>>>    httpd.conf:AddType application/x-httpd-php-source .phps
>>>    httpd.conf:    <IfModule mod_php3.c>
>>>    httpd.conf:        <IfModule mod_php4.c>
>>>    httpd.conf:            DirectoryIndex index.php index.php3 
>>> index.html
>>>    httpd.conf:        <IfModule !mod_php4.c>
>>>    httpd.conf:            DirectoryIndex index.php3 index.html
>>>    httpd.conf:    <IfModule !mod_php3.c>
>>>    httpd.conf:        <IfModule mod_php4.c>
>>>    httpd.conf:            DirectoryIndex index.php index.html
>>>    httpd.conf:        <IfModule !mod_php4.c>
>>>    httpd.conf:    <IfModule mod_php3.c>
>>>    httpd.conf:     AddType application/x-httpd-php3 .php3
>>>    httpd.conf:     AddType application/x-httpd-php3-source .php3s
>>>    httpd.conf:    <IfModule mod_php4.c>
>>>    httpd.conf:     AddType application/x-httpd-php .php
>>>    httpd.conf:     AddType application/x-httpd-php-source .phps
>>>    httpd.conf:     AddType application/x-httpd-php .php
>>>    httpd.conf:     AddType application/x-httpd-php-source .phps
>>>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> freebsd-questions at freebsd.org mailing list
>>> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
>>> To unsubscribe, send any mail to 
>>> "freebsd-questions-unsubscribe at freebsd.org"
>>>
>>> .
>>>
>> Hello Jack,
>> I have 2 servers running one with php4 and one with php5
>>
>> In the php4 httpd.conf I have:
>> LoadModule php4_module        libexec/apache/libphp4.so
>> AddModule mod_php4.c
>>
>> # DirectoryIndex: Name of the file or files to use as a pre-written HTML
>> # directory index.  Separate multiple entries with spaces.
>> #
>> <IfModule mod_dir.c>
>>    <IfModule mod_php3.c>
>>        <IfModule mod_php4.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_php4.c>
>>            DirectoryIndex index.php index.html
>>        </IfModule>
>>        <IfModule !mod_php4.c>
>>            DirectoryIndex index.html
>>        </IfModule>
>>    </IfModule>
>> </IfModule>
>>
>> # LanguagePriority allows you to give precedence to some languages
>>    # in case of a tie during content negotiation.
>>    #
>>    # Just list the languages in decreasing order of preference. We have
>>    # more or less alphabetized them here. You probably want to change 
>> this.
>>    #
>>    <IfModule mod_negotiation.c>
>>        LanguagePriority en da nl et fr de el it ja kr no pl pt pt-br 
>> ru ltz ca es sv tw
>>    </IfModule>
>>
>>    <IfModule mod_php3.c>
>>    AddType application/x-httpd-php3 .php3
>>    AddType application/x-httpd-php3-source .php3s
>>    </IfModule>
>>    <IfModule mod_php4.c>
>>    AddType application/x-httpd-php .php
>>    AddType application/x-httpd-php-source .phps
>>    </IfModule>
>>
>>
>> In the Apache2 using php5 I have in the httpd.conf
>> LoadModule php5_module libexec/apache2/libphp5.so
>>
>> # If the AddEncoding directives above are commented-out, then you
>> # probably should define those extensions to indicate media types:
>> #
>> AddType application/x-compress .Z
>> AddType application/x-gzip .gz .tgz
>>
>> AddType application/x-httpd-php .php
>> AddType application/x-httpd-php-source .phps
>>
>> I hope this helps you with your configuration,
>> Regards,
>> Ivan
>>
> I don't have libphp5.so anywhere in /usr/local (did a find for it).
> the php5 port is broken?  Or do I have to reinstall apache after php5?
>
>
>
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to 
> "freebsd-questions-unsubscribe at freebsd.org"
>
> .
>
Jack,
When I want a system with Apache PHP and MySQL.
I install them in the following order.

1. Install Apache
2. Install PHP via /usr/lang/php5-extensions (select the extensions you 
want, this will install php5 and add the required lines to the httpd.conf)
3. Install MySQL

Regards,
Ivan


More information about the freebsd-questions mailing list