Apache, php?

Jack Barnett jackbarnett at gmail.com
Thu Jun 21 01:53:17 UTC 2007


doug wrote:
> On Tue, 19 Jun 2007, 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
>>
> I just installed this combination, among the changes to httpd.conf I 
> change pph4-->php5 (see below). You are not getting an index file. If 
> you have 'Options +Indexes' browsing will get you an index listing but 
> will not run index.php.
>
>
>  #
>  # This may also be "None", "All", or any combination of "Indexes",
> @@ -452,18 +454,18 @@
>  #
>  <IfModule mod_dir.c>
>      <IfModule mod_php3.c>
> -        <IfModule mod_php4.c>
> +        <IfModule mod_php5.c>
>              DirectoryIndex index.php index.php3 index.html
>          </IfModule>
> -        <IfModule !mod_php4.c>
> +        <IfModule !mod_php5.c>
>              DirectoryIndex index.php3 index.html
>          </IfModule>
>      </IfModule>
>      <IfModule !mod_php3.c>
> -        <IfModule mod_php4.c>
> +        <IfModule mod_php5.c>
>              DirectoryIndex index.php index.html
>          </IfModule>
> -        <IfModule !mod_php4.c>
> +        <IfModule !mod_php5.c>
>              DirectoryIndex index.html
>          </IfModule>
>      </IfModule>
>

hrm... no I don't think that's it.
I put this in:
    DirectoryIndex index.php index.html

I have php5 install

I created this file:
test.php
    <?php print ("Hello World<BR>\n"); ?>
But that doesn't work either.

Is mod_layout screwing it up?

I don't understand what is wrong with it?
`php test.php` works fine.

Also there is no Module Load/Add in the httpd.conf for php.  I can't 
even find the libraries!

But /usr/local/bin/ has php and php-cgi (both executables).

Do I need to tell apache how to execute .php files?

















More information about the freebsd-questions mailing list