# [SOLVED] Cannot have php module activated on apache

## augustin2

Hi,

I have installed apache following the guide on the wiki. After that I have created en file in /var/www/localhost/htdocs/index.html with this content:

 *Quote:*   

> <html>
> 
>  <body>
> 
> <h1> It works and you should have php info table</h1>
> ...

 

When I point the browser on localhost I get 

 *Quote:*   

>  It works and you should have php info table

  but not the php info table. If I rename the file to index.php I only get the display of the directory content. 

I have dev-lang/php installed and APACHE2_OPTS="... -D PHP5" in /etc/conf.d/apache2.Last edited by augustin2 on Sat Feb 01, 2014 8:22 am; edited 1 time in total

----------

## 666threesixes666

does /etc/apache2/modules.d/70_mod_php5.conf say

```

<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>

```

try writing it as

/var/www/localhost/htdocs/index.php with

<?php

phpinfo();

?>

& go to localhost/index.php

instead.

if all that matches and still does not work, see troubleshooting article on wiki.gentoo.org and past more information about your setup.

----------

## augustin2

Hi. Thank you for answer.

I have no 70_mod_php5.conf

Here is the content of the modules.d directory

 *Quote:*   

> .                         00_languages.conf       00_mod_mime.conf     10_mod_mem_cache.conf  .keep_www-servers_apache-2
> 
> ..                        00_mod_autoindex.conf   00_mod_status.conf   40_mod_ssl.conf
> 
> 00_default_settings.conf  00_mod_info.conf        00_mod_userdir.conf  45_mod_dav.conf
> ...

 

As for the change in index.php it doesn't change anything.

----------

## 666threesixes666

"I have no 70_mod_php5.conf"

previous thread about this "that's a show stopper"

drop my 70 into your 70 then restart apache.

-rw-r--r-- 1 root root 439 Dec  1 16:57 /etc/apache2/modules.d/70_mod_php5.conf

are my permissions.Last edited by 666threesixes666 on Wed Jan 22, 2014 8:17 am; edited 1 time in total

----------

## xaviermiller

Hello,

Did you enable php support in Apache during emerge ?

can you provide the output of 

```
emerge -pv apache
```

----------

## augustin2

 *XavierMiller wrote:*   

> Hello,
> 
> Did you enable php support in Apache during emerge ?
> 
> can you provide the output of 
> ...

 

Thank you. 

I have php and apache2  in use flags in make.conf but reading  the apache page on the wiki maybe I should had something like APACHE2_MODULES=" php" 

isn't it ?

At the moment 

```
emerge --info apache
```

 gives

 *Quote:*   

> USE="ldap (multilib) ssl -debug -doc (-selinux) -static -suexec -threads" ABI_X86="64" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias -asis -auth_digest -authn_dbd -cern_meta -charset_lite -dbd -dumpio -ident -imagemap -log_forensic -proxy -proxy_ajp -proxy_balancer -proxy_connect -proxy_ftp -proxy_http -proxy_scgi -reqtimeout -substitute -version" APACHE2_MPMS="-event -itk -peruser -prefork -worker"
> 
> LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--no-as-needed"

 

----------

## augustin2

 *666threesixes666 wrote:*   

> 
> 
> previous thread about this "that's a show stopper"
> 
> drop my 70 into your 70 then restart apache.
> ...

 

Hum! I have trouble understanding what you mean?!

----------

## augustin2

I have manually added the 70_mod_php.conf manually as 666threesixes666 decribed it in his first answer and it works. 

I thought this file was automatically created at install. Should it be or not ? I didn't see that I had to do it manually neither in the apache article or in the php article in the wiki.

----------

## xaviermiller

did you add apache2 in the php USE flag ? I guess php install the config file only if that USE is enabled.

----------

## augustin2

apache2 use flag is  enabled globally in make.conf

and I added php flag to apache in /etc/portage/package.use

----------

## 666threesixes666

? profit....

its a bug, i have no idea how big or wide spread it is, where it crept in or what.  seems like this was not a problem a year ago.  it became a problem approximately 3 months ago.

apparently you're supposed to eselect php list apache2 & set that.  i don't think its linking the 70 mod php correctly.

----------

## Cr0t

 *666threesixes666 wrote:*   

> does /etc/apache2/modules.d/70_mod_php5.conf say
> 
> ```
> 
> <IfDefine PHP5>
> ...

 This worked! thx!

----------

