# PHP5

## nford

I have installed apache, php and mod_php.

I can load html pages from a web browser, but when I try to load a php page, it treats the page as a file and asks me if I want to download the actual php file.

This must be a config setting somewhere, I just cant find it  :Sad: 

----------

## 59729

```

lappen@anderslejon lappen # sudo grep PHP5 /etc/conf.d/apache2

APACHE2_OPTS="-D SSL -D PHP5"

```

----------

## nford

When run that command, I get the same response

----------

## 59729

```

lappen@anderslejon init.d # sudo cat /etc/apache2/conf/modules.d/70_mod_php5.conf

<IfDefine PHP5>

        # Load the module first

        <IfModule !sapi_apache2.c>

                LoadModule php5_module    modules/libphp5.so

        </IfModule>

        # Set it to handle the files

        <IfModule mod_mime.c>

                AddType application/x-httpd-php .php

                AddType application/x-httpd-php .phtml

                AddType application/x-httpd-php .php3

                AddType application/x-httpd-php .php4

                AddType application/x-httpd-php .php5

                AddType application/x-httpd-php-source .phps

        </IfModule>

</IfDefine>

```

if you are using the conf/init gentoo style this file should be there, if it is there with that content and you have loaded the module then I have no idea .. you have restarted apache right?

----------

## 59729

if nothing works tail the logs, might give some insight on whats happening

----------

## AristoMagnus

It does the same here, on the Gentoo 2.6.11 AMD64 version

I have every config file, my AddType are on the 70_mod_php.conf 

also the -D PHP5 arg is set.

No idea how to fix it.. 

any idea everyone?

----------

## AristoMagnus

You need to merge php5.0.3-r1 and mod_php5.0.3-r1 

I see that on freenode

ciao

----------

## 59729

Strange I only have the module '5.0.3-r1' and it works

----------

## nford

I also have the same configuration stuff set.  Though I am also running amd64 - perhaps its a compatibility problem?

I tried downgrading to php4 but I still get the same problem.

----------

## nford

Strange thing - It wasn't working then I restarted my computer and it now works.

I dont know whether or not to be happy - I still dont know what the problem was  :Confused: 

----------

## H0bb3z

I have Apache 2.0.53 (new config convention), php 5.0.3 and mod_php 5.0.3 enabled and working on my sparc64 box (finally!).

I had to modify the ebuild for mod_php (/var/db/pkg/dev-php/mod_php-5.0.3/mod_php-5.0.3.ebuild) to change all references to the old configuration convention (i.e. /etc/apache2/conf/apache2.conf) to the new convention (/etc/apache2/httpd.conf).  Once I made the ebuild mods, I could run:

```
ebuild /var/db/pkg/dev-php/mod_php-5.0.3/mod_php-5.0.3.ebuild config
```

This seemed to get some of it right, but I ended up having to create the 70_mod_php5.conf file listed in lappen's post above in the /etc/apache2/modules.d/ directory where the other ssl configs were (likely because my edits to the ebuild may have been incorrect for that reference).

That seemed to do the trick because now the <? phpinfo() ?> test page is a) actually displaying now and b) showing the right version of php... :Very Happy: 

----------

## H0bb3z

 *lappen wrote:*   

> Strange I only have the module '5.0.3-r1' and it works

 

I noticed my mod_php lib and php lib are slightly different, so you may be onto something:

```
fangorn apache2 # find / -type f -iname 'libphp5.so' -ls

83212  4796  -rwxr-xr-x  1 root  root    4898032  Mar 24 08:32 /usr/lib/apache2/modules/libphp5.so

83211  4660  -rwxr-xr-x  1 root  root    4756764  Mar 24 07:52 /usr/lib/libphp5.so
```

----------

## ExWindowsFan

and this post had a fix

https://forums.gentoo.org/viewtopic-t-422629-highlight-php5.html

----------

## MEW

Did you restart Apache after changing the configuration? That's probably what you needed to do. 

You probably don't need both packages installed; each inherits from an eclass that is PHP; the php or mod_php ebuild only sets up the interface (Apache SAPI vs. cli/cgi/whatever the php ebuild installs).

----------

