# mod_php not working properly...

## orange1

so, i've got apache emerged, and i emerged mod_php, did  the ebuild, and my php pages are still showing up and just a bunch of text.  the php isn't getting processed.

did i miss something?

i've looked through php.ini, and there didn't appear to be anything that should stop it from working [no exec directories that i noticed].  i've added '-D PHP4' to /etc/conf.d/apache.

----------

## fyerk

Are you loading the modules correctly in your Apache configuration file? And, do you have the application type defined?

To see if the module is being loaded look for LoadModule php4_module and AddModule mod_php4.c.

To see if the application type is defined, look for: AddType application/x-httpd-php .php .php4 .php3 .phtml

----------

## rac

Did you run the ebuild config command, like mod_php asked you to do when it finished emerging?

----------

## orange1

yes to both.  i ran the ebuild, and it added the module lines, and the mime-type lines.  the pages use <?php, so it's not the short tag thing either.

permissions on the files look alright [775].

but it's still just displaying everything as plain text.

----------

## fyerk

Does PHP4 actually get loaded?

```

ps -wwwaux | grep httpd

```

Look for -DHAVE_PHP4

----------

## grakker

Ummmm....  What do you have in your /etc/apache/conf/apache.conf?  Mine looks like:

```
> grep mod_php /etc/apache/conf/*

apache.conf:AddModule mod_php4.c

apache.conf:Include conf/addon-modules/mod_php.conf

```

Also, is there anything logged in your /var/log/apache/error_log?

----------

## orange1

nope, don't see that.

my /etc/conf.d/apache looks like this:

APACHE_OPTS="-D PHP4"

that seems to be what emerge told me at the end, and what all the forums say to have.

apache.conf says <IfDefine PHP4> et cetera.

----------

## orange1

 *grakker wrote:*   

> Ummmm....  What do you have in your /etc/apache/conf/apache.conf?  Mine looks like:
> 
> ```
> > grep mod_php /etc/apache/conf/*
> 
> ...

 

have exactly that.

and nada in the error logs, except for a couple of broken links that other people have hit.

----------

## fyerk

Are you using the init scripts to start Apache, and not the binary?

```

# /etc/init.d/apache start

```

----------

## orange1

i've been doing restart, but yeah, i've been using the init scripts.

but i'll be damned if doing a stop, and then a start would make it work.

i hate simple things.  why can't these solutions be more complicated?

anywho, thanks for all the help guys.

----------

## grakker

Not sure if this will help, but it seems like I had to do something weird in my conf files.  Maybe this will help, maybe not.

```

> grep -i php /etc/apache/conf/* | grep -v php.ini

/etc/apache/conf/apache.conf:LoadModule php4_module        modules/libphp4.so

/etc/apache/conf/apache.conf:AddModule mod_php4.c

/etc/apache/conf/apache.conf:Include conf/addon-modules/mod_php.conf

/etc/apache/conf/commonapache.conf:    DirectoryIndex index.php index.html index.php3 index.shtml index.cgi index.pl index.htm Default.htm default.htm

/etc/apache/conf/commonapache.conf:    AddIcon /icons/p.gif .pl .py .php .php3

/etc/apache/conf/commonapache.conf:    Addtype application/x-httpd-php3 .php3

/etc/apache/conf/commonapache.conf:    Addtype application/x-httpd-php3-source .php3s

/etc/apache/conf/commonapache.conf:    Addtype application/x-httpd-php .php

/etc/apache/conf/commonapache.conf:    Addtype application/x-httpd-php-source .phps

/etc/apache/conf/mime.types:application/x-httpd-php

```

----------

## fyerk

Looking at the /etc/init.d/apache file, it appears that a restart only sends a USR1 signal to the daemon. To reload the modules, I'm pretty sure it needs a clean stop and start -- i.e. a TERM signal, and then restarting the binary.

I don't really know why but I'm glad it worked   :Smile: 

----------

## catalYst

Ok, a full stop might have worked for edge...but I'm getting the same problem except the root of it lies in the apache warning:

```
[<datestamp>] [warn] module php4_module is already loaded, [ok]
```

And I don't know how to fix it...

-colin

----------

## fyerk

Check your apache configuration file to see if you're loading the PHP module in multiple places.

----------

## dj_choco

 *edge wrote:*   

> Are you using the init scripts to start Apache, and not the binary?
> 
> ```
> 
> # /etc/init.d/apache start
> ...

 

[edit]I was also trying to load mod_php twice   :Sad:  [/edit]

Thank you  :Laughing: 

I was using 

```
apachectl start
```

 instead of

```
/etc/init.d/apache start
```

mod_php working (I guess it really always was  :Cool:  )

----------

