# Apache not executing PHP code on gentoo 64

## oandarilho01

Hi,

I used to run a VPS gentoo 32 bits with some Apache VHOSTs.

Then occurred a problem on the VPS that forced me to reinstall the OS, and from that moment the VPS gentoo template became 64 bits.

Since that I can't get my VHOSTs to work again because apache is not executing PHP code normally.

I tested and it execute PHP code when I use DEFAULT_VHOST option, but I don't want to use it. If I load apache w/o it, PHP code is printed out on the browser.

Some guys on a IRC gentoo channel suggested that now there's some kind of VHOST-oriented PHP config.

Can someone here help me?

Thanks in advance

----------

## gerdesj

Have you set -D PHP5 in /etc/conf.d/apache?  That should be all you need.

Can you post an example <vhost>.conf so we have something to work with.

Cheers

Jon

----------

## musv

After the last update I have the same problem. Did I forget to configure something?

```
APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D MANUAL -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE -D PHP5"
```

```
 eix -ecI php

[I] dev-lang/php (5.4.0_rc4(5.4)@04.01.2012): The PHP language runtime engine: CLI, CGI, FPM/FastCGI, Apache2 and embed SAPIs.

 eix -ecI apache

[I] www-servers/apache (2.2.21-r1(2)@05.01.2012): The Apache Web Server.
```

revdep rebuild tells me, that my system is consistent.

When I call: http://localhost/phpinfo.php I get:

```
<?php phpinfo(); ?>
```

----------

## Yuu

Hi,

did you have this line on your /etc/apache2/httpd.conf ?

```
Include /etc/apache2/modules.d/*.conf
```

This line include all .conf files in the modules.d/ directory.

Another interesting file linked to this previous setting is : /etc/apache2/modules.d/70_mod_php5.conf :

```
<IfDefine PHP5>

        # Load the module first

        <IfModule !mod_php5.c>

                LoadModule php5_module    modules/libphp5.so

        </IfModule>

        # Set it to handle the files

        <IfModule mod_mime.c>

                AddHandler application/x-httpd-php .php .php5 .phtml

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

        </IfModule>

        DirectoryIndex index.php index.phtml

</IfDefine>
```

This allow .php, .php5 and .phtml files to use the PHP handler.

Good luck :}

----------

## musv

 *Yuu wrote:*   

> Another interesting file linked to this previous setting is : /etc/apache2/modules.d/70_mod_php5.conf :

 

For some reason that file was missing. Thx, that solved the problem.

----------

## 666threesixes666

2.2.25 apache didn't deploy with 70_mod_php or php 5.5.6 & 5.5.4...  thus my thread necromancy.  sorry   :Evil or Very Mad: 

----------

