# Apache 2 and PHP not rendering PHP pages

## proto

I'm running Apache 2.0.47 and PHP 4.3.2-r4/5 but the PHP pages just display as plain text... It isn't rendered...

Any ideas?

The module apears to be loaded and everything for the config.Last edited by proto on Fri Sep 12, 2003 4:26 pm; edited 1 time in total

----------

## cchee

make sure you have -D PHP4 in your /etc/conf.d/apache or /etc/conf.d/apache2  file.

----------

## proto

just checked it again... its in there... i'm still looking around... any other ideas?

i'm dead in the water without php

----------

## proto

actually in /etc/conf.d/apache2 i have the -D PHP4 but I can't see anything regarding php in /etc/conf.d/apache2. WHat would I need to add?

----------

## proto

I have NO clue what I just did but after applying the setting a couple times it just works now... I will want to look more into that that little thing was about... very odd

----------

## Sir.Dude

I've the same problem here...

when I enter http://localhost/phpinfo.php I get a blank page with in the source just <%phpinfo();%>

In conf.d/apache2 I have added the line APACHE2_OPTS="-D SSL -D PHP4" So it has to parse .php file.

The SSL works! so there must be something wrong with the php install.

emerge:

dev-php/mod_php-4.3.2-r4

net-www/apache-2.0.47

Does somebody have a clue?

----------

## Neech

 *Quote:*   

> 
> 
> make sure you have -D PHP4 in your /etc/conf.d/apache or /etc/conf.d/apache2 file.
> 
> 

 

also make sure you remove the # in front of the line (e.g don't have it commented out ) 

than it should work  :Wink: 

----------

## Sir.Dude

 :Smile:  there is no # in front of it...

mention de -D SSL thing is working the filename.php is working but it isn't parsed. I get a black page with my php code in de the source.

the download dialog box is not the problem

----------

## mccavity

 *Sir.Dude wrote:*   

> ...it isn't parsed. I get a black page with my php code in de the source.

 

I assume you restarted the apache web server? I had the same problem, editing /etc/conf.d/apache2 by enabling APACHE2_OPTS, adding "-D PHP4" and restarting Apache did the trick... voilà: instant php...

----------

## Sir.Dude

I've added the -D PHP4 thing.

Also I've reemerged PHP apche mod_php etc I;ve even tried apache 1.3 and this isn't working eighter.

Still a white screen with my PHP code in the source... unparsed

----------

## indros

Try surfing to a page that doesn't exist. When you get the 404 Error page, take note of the line in italics that will look somewhat like this

 *Quote:*   

> 
> 
> Apache/2.0.47 (Gentoo/Linux) mod_ssl/2.0.47 OpenSSL/0.9.6j DAV/2 PHP/4.3.3 Server at www.thezees.net Port 443
> 
> 

 

What you'll be looking for specifically, is the part that says PHP.

----------

## dreamer

Do you have these lines in your /etc/apache2/conf/apache2.conf ?

```

LoadModule php4_module extramodules/libphp4.so

AddType application/x-httpd-php .php

```

----------

## Sir.Dude

At the 403 page stands

 *Quote:*   

> Apache/2.0.47 (Gentoo/Linux) mod_ssl/2.0.47 OpenSSL/0.9.6j PHP/4.3.2 Server at localhost Port 80

 

LoadModule php4_module extramodules/libphp4.so 

AddType application/x-httpd-php .php

this is loaded with the folowing line.

Include conf/modules.d/*.conf

----------

## CrunchyB

bahLast edited by CrunchyB on Fri Sep 26, 2003 8:22 pm; edited 1 time in total

----------

## CrunchyB

Hmmm...same here. I entered the settings and according to the 404 screen:

"Apache/2.0.47 (Gentoo/Linux) PHP/4.3.2 Server at...."

But it doesn't process PHP. So it did some snooping around and this line in apache2 caught my attention.

"Include conf/modules.d/*.conf"

This seems to load a few script, one of which is called "70_mod_php.conf" and seems to set a bunch of PHP stuff. And sure enough, when entering the settings in the installation guide there is a non-fatal error "[Fri Sep 26 21:57:18 2003] [warn] module php4_module is already loaded, skipping"

So I removed the line, which did absolutely nothing except getting rid of that error message at apache2 startup. PHP still doesn't work.

So I put it back in and removed the installation guide settings, but now PHP isn't even mentioned on the 404 screen! So what's going on here?

----------

## Redeeman

i just added the thing in /etc/conf.d/apache and then it worked with php, after i emerged mod_php

//Redeeman

----------

## CrunchyB

Ok, I got it working now. 

```
APACHE2_OPTS="-D PHP4" 
```

 in conf.d/apache2 is the only thing you have to change to make it all work.

----------

## Dergro

grrr I've been trying to get php working all night when all i had to do was uncomment the line

#APACHE2_OPTS="-D SSL -D PHP4"

I'm blind......  :Rolling Eyes: 

----------

## squealie

Please, please help.

I've been trying to make this work for days.  No luck, no clues.

Apache 2 is up.

No php rendering.

I have APACHE2_OPTS="-D SSL -D PHP4" in /etc/conf.d/apache2

What else can I check?

Name resolution (local, on the server) doesn't have anything to do with this does it?

----------

## percking

 *Quote:*   

> Please, please help.
> 
> I've been trying to make this work for days. No luck, no clues.
> 
> Apache 2 is up.
> ...

 

I was having issues with mod_php and apache and found it was one my my CFLAGS...check out this post

https://forums.gentoo.org/viewtopic.php?t=76156

Hope this helps...

percking

----------

