Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
mod_php not parsing pages with Apache 2.0.49
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
bhelmkamp
n00b
n00b


Joined: 19 Dec 2003
Posts: 9
Location: East Lansing, MI

PostPosted: Tue Apr 27, 2004 10:53 pm    Post subject: mod_php not parsing pages with Apache 2.0.49 Reply with quote

I emerge apache and mod_php and edited /etc/conf.d/apache2 to have the line:

Code:
APACHE2_OPTS="-D PHP4"


The server starts up fine (without warnings or errors) and serves pages, but it will not parse PHP code. Yes, the code is in a .php file.

I tried manually adding a LoadModule line to /etc/apache2/conf/apache2.conf for PHP, but then I get warnings saying that the module is already loaded when I start the server. This leads me to believe that Apache is successfully loading mod_php in /etc/apache2/conf/modules.d/70_mod_php.conf .

This has me completely stumped. Can anyone please help me?

Thanks.
Back to top
View user's profile Send private message
Spaz17
n00b
n00b


Joined: 01 Jan 2004
Posts: 41
Location: /home/spaz

PostPosted: Tue Apr 27, 2004 11:41 pm    Post subject: Reply with quote

I second the issue.

That is, I'm having the same problem.
Back to top
View user's profile Send private message
Toe Knee
n00b
n00b


Joined: 07 Apr 2004
Posts: 48
Location: Dundee

PostPosted: Wed Apr 28, 2004 2:32 pm    Post subject: Reply with quote

And I third it (if that's possible)
_________________
Toe Knee
Back to top
View user's profile Send private message
patrickbores
Apprentice
Apprentice


Joined: 19 May 2003
Posts: 276
Location: Minneapolis, MN, USA

PostPosted: Wed Apr 28, 2004 5:50 pm    Post subject: Reply with quote

Do you have one of these in your httpd.conf file?

Code:
AddType application/x-httpd-php .php

_________________
P.S. - this is what part of the alphabet would look like if Q and R were eliminated.
Back to top
View user's profile Send private message
bhelmkamp
n00b
n00b


Joined: 19 Dec 2003
Posts: 9
Location: East Lansing, MI

PostPosted: Wed Apr 28, 2004 7:08 pm    Post subject: Reply with quote

Gentoo stores the Apache configuration in /etc/apache2/conf/apach2.conf. That file does not have an AddType line for PHP, but it does have a directive to load all the configuration files in /etc/apache2/conf/modules.d/. 70_mod_php.conf, one of the files in that directory has:

Code:
<IfDefine PHP4>
                                                                                                                                                             
    # Load the module first
    <IfModule !mod_php4.c>
        LoadModule php4_module    extramodules/libphp4.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-source .phps
    </IfModule>
                                                                                                                                                             
    # Fix some bugs
    <Files *.php>
        LimitRequestBody 524288
        RequestHeader unset If-Modified-Since
    </Files>
    <Files *.php3>
        LimitRequestBody 524288
        RequestHeader unset If-Modified-Since
    </Files>
    <Files *.php4>
        LimitRequestBody 524288
        RequestHeader unset If-Modified-Since
    </Files>
    <Files *.phps>
        LimitRequestBody 524288
        RequestHeader unset If-Modified-Since
    </Files>
    <Files *.phtml>
        LimitRequestBody 524288
        RequestHeader unset If-Modified-Since
    </Files>
                                                                                                                                                             
</IfDefine>


That all depends on PHP4 being defined, which is supposed to happen with this line in /etc/conf.d/apache2:

Code:
APACHE2_OPTS="-D PHP4"


It seems the directives in 70_mod_php.conf are executed, because if I repeat the LoadModule line in apache2.conf I get a "module already loaded" warning.
Back to top
View user's profile Send private message
patrickbores
Apprentice
Apprentice


Joined: 19 May 2003
Posts: 276
Location: Minneapolis, MN, USA

PostPosted: Thu Apr 29, 2004 12:25 am    Post subject: Reply with quote

The AddType directives are executed conditionally. Can you verify that mod_mime has been loaded?

Patrick
_________________
P.S. - this is what part of the alphabet would look like if Q and R were eliminated.
Back to top
View user's profile Send private message
bhelmkamp
n00b
n00b


Joined: 19 Dec 2003
Posts: 9
Location: East Lansing, MI

PostPosted: Thu Apr 29, 2004 4:17 am    Post subject: Reply with quote

patrickbores wrote:
Can you verify that mod_mime has been loaded?


Yes. If I comment out the IfModule and /IfModule lines, everything still works fine. If mod_mime was not loaded Apache would complain it didn't understand the AddType directives.
Back to top
View user's profile Send private message
Longchamps
n00b
n00b


Joined: 29 Apr 2004
Posts: 6

PostPosted: Thu Apr 29, 2004 4:46 pm    Post subject: Reply with quote

Ive got the same problem with the php parsing;

-in mozilla: it shows me the code and doesnt parse it
-using lynx: it gives me an error msg; "panic: config.inc.php doesnt exist!!..."

ive done all the apache2 configs that are in the tutorials, i think this is more of an install problem?
but why, and where is this file supposed to be? i didnt get any errors during the mod_php emerge or the ebuild. does anybody know this one?
Back to top
View user's profile Send private message
danwatt
n00b
n00b


Joined: 08 Oct 2003
Posts: 64

PostPosted: Thu Apr 29, 2004 6:48 pm    Post subject: Reply with quote

I am having the exact same problem, and it all started after I emerged (upgraded) 2.0.49. I tried to update PHP to 4.3.6, but that hasnt helped. I think there is a setting that was added to apache2.conf, but in my haste this morning I deleted the modified apache2.conf in etc-update (silly me). I think I might just re-emerge apache and PHP alltogether, unless someone comes up with a better solution.
_________________
Two boxes and counting: personal PC, student organization server w/ full portage and distfiles mirror
Back to top
View user's profile Send private message
danwatt
n00b
n00b


Joined: 08 Oct 2003
Posts: 64

PostPosted: Thu Apr 29, 2004 8:06 pm    Post subject: Reply with quote

Fixed it

bhelmkamp is right. Open /etc/conf.d/apache2, and you need to find the line that has #APACHE2_OPTS= commented out (the #). Add -D PHP4 into the quotes, and any other parameter you might need (for me -D SSL and -D DAV).
_________________
Two boxes and counting: personal PC, student organization server w/ full portage and distfiles mirror
Back to top
View user's profile Send private message
Longchamps
n00b
n00b


Joined: 29 Apr 2004
Posts: 6

PostPosted: Thu Apr 29, 2004 8:17 pm    Post subject: Reply with quote

i did that, still the same error. even tried removing -d SSL just in case. :(
Back to top
View user's profile Send private message
bhelmkamp
n00b
n00b


Joined: 19 Dec 2003
Posts: 9
Location: East Lansing, MI

PostPosted: Thu Apr 29, 2004 8:34 pm    Post subject: Reply with quote

I'm going to file this as a bug and reference this thread. I (and apparently many others) am still looking for a solution though.

Update: Filed as bug #49420.
Back to top
View user's profile Send private message
direwolf
Tux's lil' helper
Tux's lil' helper


Joined: 11 Jun 2003
Posts: 125
Location: Richmond, VA

PostPosted: Fri Apr 30, 2004 2:30 am    Post subject: apache2 & php Reply with quote

It works for me, but I had to manually add these links in /etc/apache2 directory:

Code:

extramodules -> /usr/lib/apache2-extramodules
lib -> /usr/lib
logs -> /var/log/apache2
modules -> /usr/lib/apache2/modules
Back to top
View user's profile Send private message
Longchamps
n00b
n00b


Joined: 29 Apr 2004
Posts: 6

PostPosted: Fri Apr 30, 2004 3:56 pm    Post subject: Reply with quote

hmmm, that didnt do it for me :( :evil:
_________________
I dont suffer from insanity, i enjoy every minute of it.
Back to top
View user's profile Send private message
Immortal Q
Apprentice
Apprentice


Joined: 14 Sep 2003
Posts: 241
Location: Silicone Valley

PostPosted: Fri Apr 30, 2004 8:40 pm    Post subject: Reply with quote

I had some similar trouble with 2.0.49 - I think the Apache herd changed the layout around a bit. Editing the /etc/conf.d/apache2 file was what finally fixed it for me, but I did some other mucking around that may have changed things a bit.
_________________
Osmos.org
Now with 20% fewer rabid primates.
Back to top
View user's profile Send private message
castrik
n00b
n00b


Joined: 16 Apr 2004
Posts: 31

PostPosted: Sat May 01, 2004 1:29 am    Post subject: Reply with quote

Im also having this problem.
Back to top
View user's profile Send private message
leifbk
Guru
Guru


Joined: 05 Jan 2004
Posts: 420
Location: Bærum, Norway

PostPosted: Sat May 01, 2004 11:38 am    Post subject: Reply with quote

I've got it working. I remember that something like this was an issue with the previous upgrade too. In the file /etc/apache2/modules.d/40_mod_ssl.conf, the line "Listen 443" should be replaced with "Listen 0.0.0.0:443".

It looks like apache2 has some troubles with restart, too. Kill all apache2 processes, then run "/etc/init.d/apache2 restart".

HTH, Leif.
Back to top
View user's profile Send private message
castrik
n00b
n00b


Joined: 16 Apr 2004
Posts: 31

PostPosted: Sat May 01, 2004 3:16 pm    Post subject: Reply with quote

Thanks leifbk, thats a mighty weird bug, it fixed mine even when "-D SSL" was removed from /etc/conf.d/apache2 so that was strange.

Thanks again for your help.
Back to top
View user's profile Send private message
Longchamps
n00b
n00b


Joined: 29 Apr 2004
Posts: 6

PostPosted: Tue May 04, 2004 4:37 pm    Post subject: Reply with quote

ok, ive tried lots of different things, whats new; now even mozilla gives me the "panic: config.inc.php doesnt exist!!..." when i try to parse .PHP files.
the complet error msg says ;

panic: config.inc.php doesn't exist!! Did you backup it after installation? ...
(If you run this tool for the first time: please read the file INSTALL in the PHProjekt root directory)

now heres what i dont get; where is this phproject directory (its not in my home/ like ive been told..)? i read in the phproject forums that it might be a permission thing during install (i installed as root and my gentoo is almost virgin from a stage 2).
Is this A error message or THE error message. in other words is this really my problem?
apache works fine when serving html files.
i get the php_mod already loaded thingy, wich implies my php module gets loaded thru the 70_mod_php.conf file..,
yes i did the ebuild cmd after emerge. i tried emerging both mod_php***rc2 and r3. both give me the same prob

btw, what the hell is phprojekt anyway? is this the mod_php or some garbage that got in due to USE= flags that were wrong.
I know, as stated under my name... im a n00b.
_________________
I dont suffer from insanity, i enjoy every minute of it.
Back to top
View user's profile Send private message
Longchamps
n00b
n00b


Joined: 29 Apr 2004
Posts: 6

PostPosted: Tue May 04, 2004 11:43 pm    Post subject: Reply with quote

K, so i got tired of "trying" and reinstalled the whole thing (gentoo).
works. :?
_________________
I dont suffer from insanity, i enjoy every minute of it.
Back to top
View user's profile Send private message
Evansbee
n00b
n00b


Joined: 04 May 2004
Posts: 6
Location: Bethlehem, Pa

PostPosted: Wed May 05, 2004 2:56 am    Post subject: Reply with quote

Make sure the permissions are correct on your php files. When I first setup apache i noticed that it wasn't parsing my php files. when i did an ls -al on the directory it became clear instantly.
Back to top
View user's profile Send private message
Olmo Ziarko
n00b
n00b


Joined: 03 May 2004
Posts: 4
Location: Brussels

PostPosted: Wed May 05, 2004 1:46 pm    Post subject: how do you start apache? Reply with quote

Be sure to start apache with '/etc/init.d/apache start'.
*not* just 'apache2 [-k] start'.

I thought I was suffering from the same bug y'all were,
untill I noted that *that* was what I was doing wrong.
_________________
im always fixin
Back to top
View user's profile Send private message
ynef
n00b
n00b


Joined: 14 Jan 2004
Posts: 69
Location: Lund, Sweden

PostPosted: Wed May 05, 2004 4:47 pm    Post subject: Reply with quote

leifbk wrote:
I've got it working. I remember that something like this was an issue with the previous upgrade too. In the file /etc/apache2/modules.d/40_mod_ssl.conf, the line "Listen 443" should be replaced with "Listen 0.0.0.0:443".

It looks like apache2 has some troubles with restart, too. Kill all apache2 processes, then run "/etc/init.d/apache2 restart".

HTH, Leif.

You're a genius! :D

Also, it didn't work for me when I told it to just "restart" either -- had to tell it to stop and then start... don't ask me why that changed anything:?:
Back to top
View user's profile Send private message
alllle
n00b
n00b


Joined: 05 May 2004
Posts: 42

PostPosted: Thu May 06, 2004 6:14 am    Post subject: Got the same problem and it is now fixed Reply with quote

I had the same problem and by reading this thread and adding the '-D PHP4' flag, it worked.

I think the trick here is to completely shutdonw the Apache and restart it, both using the init script:
/etc/init.d/apache2 stop
/etc/init.d/apache2 start


A question though: how do you know you suppose to edit the /etc/conf.d/apache2 file and add the '-D PHP4' flag at the first place? Where should I look for information under similar situation in the future?

Thanks!
Back to top
View user's profile Send private message
Longchamps
n00b
n00b


Joined: 29 Apr 2004
Posts: 6

PostPosted: Thu May 06, 2004 7:20 pm    Post subject: Reply with quote

Quote:

A question though: how do you know you suppose to edit the /etc/conf.d/apache2 file and add the '-D PHP4' flag at the first place? Where should I look for information under similar situation in the future?


look carefully at the end of emerge mod_php, it clearly says to add the '-D PHP4' flag.
_________________
I dont suffer from insanity, i enjoy every minute of it.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum