# [SOLVED] Apache PHP problem after update world

## midnite

Just, i updated portage and world.

My apache server was work fine with PHP pages. But after updated, it return the _RAW_ codes for .php pages!!

it is even text/plain!!! the html tags (eg <BR>) are showing also!!!

why ?   :Crying or Very sad: 

all i have done is just the following lines:

```
# emerge --sync

# emerge --ask --deep --newuse --update --verbose world
```

then replace the files with the ._cfg0000_ ones

one thing i have noticed is that, the http.conf changed a lot. Before, there was many things such as DirectoryIndex index.html. Now it shrank from 1104 to 184 lines and contains mainly LoadModule directives. It seems that it is grouping things in other files, but where are they??

PS my previous version was installed several months ago only.Last edited by midnite on Thu Sep 13, 2007 12:17 pm; edited 1 time in total

----------

## Dagger

Let's start from checking your /etc/conf.d/apache2 if it contains APACHE2_OPTS="-D PHP5"

----------

## midnite

Thanks. I though it works too, but sadly....

first, my /etc/conf.d/apache2 really do not have APACHE2_OPTS="-D PHP5". Then i added it and it become:

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

(as i remember, the previous /etc/conf.d/apache2 have no APACHE2_OPTS="-D PHP5" too. But there was KEEPENV="PATH")

then it fails when i want to restart it:

```
# /etc/init.d/apache2 restart

 * Caching service dependencies ...

 *  Can't find service 'logger' needed by 'sensord';  continuing...                                                                                    [ ok ]

 * Apache2 has detected a syntax error in your configuration files:

apache2: Syntax error on line 175 of /etc/apache2/httpd.conf: Syntax error on line 4 of /etc/apache2/modules.d/70_mod_php5.conf: API module structure 'php5_module' in file /usr/lib/apache2/modules/libphp5.so is garbled - expected signature 41503232 but saw 41503230 - perhaps this is not an Apache module DSO, or was compiled for a different Apache version?
```

then i changed -D PHP5 to -D PHP, it have no problem for restart. But still do not support PHP   :Crying or Very sad: 

for your reference:

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

                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>

        AddDirectoryIndex index.php index.phtml

</IfDefine>
```

/etc/conf.d/apache2 (with comments)

```
# /etc/conf.d/apache2: config file for /etc/init.d/apache2

# When you install a module it is easy to activate or deactivate the modules

# and other features of apache using the APACHE2_OPTS line. Every module should

# install a configuration in /etc/apache2/modules.d. In that file will be an

# <IfDefine NNN> where NNN is the option to enable that module.

# Here are the options available in the default configuration:

#

#  CACHE      Enables mod_cache

#  MEM_CACHE  Enables default configuration mod_mem_cache

#  DAV        Enables mod_dav

#  DEFAULT_VHOST   Enables name-based virtual hosts, with the default

#                  virtual host being in /var/www/localhost/htdocs

#  ERRORDOCS  Enables default error documents for many languages.

#  INFO       Enables mod_info, a useful module for debugging

#  LANGUAGE   Enables content-negotiation based on language and charset.

#  LDAP       Enables mod_ldap (available if USE=ldap)

#  AUTH_LDAP  Enables authentication through mod_ldap (available if USE=ldap)

#  MANUAL     Enables /manual/ to be the apache manual (available if USE=docs)

#  PROXY      Enables mod_proxy

#  SSL        Enables SSL (available if USE=ssl)

#  SSL_DEFAULT_VHOST   Enables default vhost for SSL (you should enable this

#                      when you enable SSL unless you know what you are doing)

#  SUEXEC     Enables running CGI scripts (in USERDIR) through suexec.

#  USERDIR    Enables /~username mapping to /home/username/public_html

#

# Warning: You need one of DEFAULT_VHOST or SSL_DEFAULT_VHOST, otherwise apache

#          will not listen for incomming connections on any port.

APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D LANGUAGE -D SSL -D SSL_DEFAULT_VHOST -D SUEXEC -D PHP5"

# Extended options for advanced uses of Apache ONLY

# You don't need to edit these unless you are doing crazy Apache stuff

# As not having them set correctly, or feeding in an incorrect configuration

# via them will result in Apache failing to start

# YOU HAVE BEEN WARNED.

# ServerRoot setting

#SERVERROOT=/usr/lib/apache2

# Configuration file location

# - If this does NOT start with a '/', then it is treated relative to

# $SERVERROOT by Apache

#CONFIGFILE=/etc/apache2/httpd.conf

# Location to log startup errors to

# They are normally dumped to your terminal.

#STARTUPERRORLOG="/var/log/apache2/startuperror.log"

# A command that outputs a formatted text version of the HTML at the URL

# of the command line. Designed for lynx, however other programs may work.

#LYNX="lynx -dump"

# The URL to your server's mod_status status page.

# Required for status and fullstatus

#STATUSURL="http://localhost/server-status"

# Method to use when reloading the server

# Valid options are 'restart' and 'graceful'

# See http://httpd.apache.org/docs/2.2/stopping.html for information on

# what they do and how they differ.

#RELOAD_TYPE="graceful"
```

----------

## PraetorZero

Have you tried re-emerging PHP?  I think the message gives you a decent idea.

```
/etc/init.d/apache2 restart

 * Caching service dependencies ...

 *  Can't find service 'logger' needed by 'sensord';  continuing...                                                                                    [ ok ]

 * Apache2 has detected a syntax error in your configuration files:

apache2: Syntax error on line 175 of /etc/apache2/httpd.conf: Syntax error on line 4 of /etc/apache2/modules.d/70_mod_php5.conf: API module structure 'php5_module' in file /usr/lib/apache2/modules/libphp5.so is garbled - expected signature 41503232 but saw 41503230 - perhaps this is not an Apache module DSO, or [b]was compiled for a different Apache version?[/b]
```

----------

## midnite

yeah! Thanks PraetorZero and also thanks to the post https://forums.gentoo.org/viewtopic-t-580379.html, i have reemerged PHP and things go right now   :Very Happy: 

the magic command:

```
# emerge -av php
```

----------

## jody

i have exactly the same problem except that it is libphp4.so which is garbled.

However if i try to 

```
emerge -av php
```

 it wont work:

```
!!! All ebuilds that could satisfy "dev-lang/php" have been masked.

!!! One of the following masked packages is required to complete your request:

- dev-lang/php-5.2.5_p20080206-r3 (masked by: package.mask)

- dev-lang/php-5.2.5_p20080206-r2 (masked by: package.mask, ~x86 keyword)

- dev-lang/php-5.2.5_p20080206 (masked by: package.mask)

- dev-lang/php-5.2.5-r1 (masked by: package.mask)

- dev-lang/php-5.2.4_pre200708051230-r2 (masked by: package.mask)

- dev-lang/php-4.4.8 (masked by: package.mask, ~x86 keyword)

/usr/portage/profiles/package.mask:

# Christian Hoffmann <hoffie@gentoo.org> (19 Oct 2007)

# masked for security reasons, bug 189172, removal scheduled for beginning of

# 2008

- dev-lang/php-4.4.8_pre20070816 (masked by: package.mask)

- dev-lang/php-4.4.4-r6 (masked by: package.mask)

```

how can i get a php-4 if they are all masked?

Thank you

  Jody

----------

## qQsh

 *jody wrote:*   

> i have exactly the same problem except that it is libphp4.so which is garbled.
> 
> However if i try to 
> 
> ```
> ...

 

You should switch to PHP5 because PHP4 is going to be unsupported. Anyway, if you really need PHP4, just unmask it by putting exact version in /etc/portage/package.unmask un package.keywords

----------

