Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Apache2 + PHP4 Help
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
wild_pointer
n00b
n00b


Joined: 30 Apr 2003
Posts: 22

PostPosted: Fri May 02, 2003 8:51 pm    Post subject: Apache2 + PHP4 Help Reply with quote

Ok, I've tried this about three times and each time I have the problem where my server doesn't parse php files, it tries to serve them for download.

This is the order in which I've been doing things.

in /etc/make.conf I have:
ACCEPT_KEYWORDS="~x86"
USE="apache2"

emerge apache
emerge mod_php

Then in /etc/conf.d/apache2 I set
APACHE2_OPTS="-D PHP4"

and in apache.conf
LoadModule php4_module /usr/lib/apache2-extramodules/libphp4.so

Actually this is in a directory like /addon/php.conf which is linked in apache.conf [I've since unmerged everything to start over, so sorry if the patthnames are a bit off]

Can someone explain exactly how I should be doing this? I'd like to get my website back up sometime this month :)


Last edited by wild_pointer on Fri May 02, 2003 10:20 pm; edited 1 time in total
Back to top
View user's profile Send private message
rizzo
Retired Dev
Retired Dev


Joined: 30 Apr 2002
Posts: 1067
Location: Manitowoc, WI, USA

PostPosted: Fri May 02, 2003 8:58 pm    Post subject: Reply with quote

Did you run the ebuild ... config command as you were directed at the end of the mod_php ebuild? The libphp4.so is installed in /etc/apache2/extramodules, not /usr/lib/.
Back to top
View user's profile Send private message
danielrm26
Tux's lil' helper
Tux's lil' helper


Joined: 18 Apr 2002
Posts: 92

PostPosted: Fri May 02, 2003 9:06 pm    Post subject: Typo? Reply with quote

I understand there may be a typo in the /etc/conf.d/apache directions. Try PHP instead of PHP4 and let me know if that works.
_________________
dmiessler.com -- grep understanding knowledge
Back to top
View user's profile Send private message
wild_pointer
n00b
n00b


Joined: 30 Apr 2003
Posts: 22

PostPosted: Fri May 02, 2003 9:36 pm    Post subject: Reply with quote

I just finished merging mod_php again, and I see no instruction for an ebuild. I tried /var/db/pkg/dev-php/mod_php-4.3.1-r2/mod_php-4.3.1-r2.ebuild config but got the following error:

/usr/sbin/ebuild.sh: line 292: //usr/sbin/apacheaddmod: No such file or directory.

I tried -D PHP as well, browser still tries to download php files.
Back to top
View user's profile Send private message
giant
Tux's lil' helper
Tux's lil' helper


Joined: 01 Aug 2002
Posts: 107

PostPosted: Fri May 02, 2003 9:59 pm    Post subject: Reply with quote

hmm I just installed apache2 with mod_php and it runs just fine.

From my memory - but I'll look this up at work the php module is not loaded in the main apache.conf.

There is a dir in the conf dir about modules and there should be a file 70php_module something. In this all necessary modules will be loaded.

I post the conf files I use when I am at work.

Word of warning if you pass on php_admin_values in your vhost.conf you will get an error when you check them with apache2 -S but it works just fine.
Back to top
View user's profile Send private message
wild_pointer
n00b
n00b


Joined: 30 Apr 2003
Posts: 22

PostPosted: Fri May 02, 2003 10:13 pm    Post subject: Reply with quote

/etc/apache2/modules.d/70_mod_php.conf has the LoadModule and AddType commands all set for me after installation.

Code:

<IfDefine PHP>
  <IfModules !mod_php4.c>
    LoadModule php4_module    extramodules/libphp4.so
  </IfModule>
</IfDefine>

<IfModule mod_mime.c>
  AddType application/x-httpd-php     .php
  ...
</IfModule>


In apache2.conf there is an Include conf/modules.d/*.conf line.

[EDIT] It would appear danielrm26 was right about the -D PHP from <IfDefine PHP> part, but it's still not working.
Back to top
View user's profile Send private message
wild_pointer
n00b
n00b


Joined: 30 Apr 2003
Posts: 22

PostPosted: Sat May 03, 2003 12:33 am    Post subject: Reply with quote

Well it started working... by itself. I copied my /test.php file to it's own directory and renamed it index.php and it loaded as expected. When I tried /test.php again it worked as well.

Thanks all.
Back to top
View user's profile Send private message
danielrm26
Tux's lil' helper
Tux's lil' helper


Joined: 18 Apr 2002
Posts: 92

PostPosted: Sat May 03, 2003 5:41 am    Post subject: Hmm... Reply with quote

Yeah, very odd. Mine still wasn't working when loading a known php page, but then I created the test.php page and tried it...

It worked.

So I guess it's working now... I know I don't like the 'flaky' feeling that I am getting - it works one minute and not the next.
_________________
dmiessler.com -- grep understanding knowledge
Back to top
View user's profile Send private message
dondajp
n00b
n00b


Joined: 11 Oct 2002
Posts: 7

PostPosted: Tue May 13, 2003 9:59 am    Post subject: Try this Reply with quote

I just fixed on mine.

after installing apache2 and mod_php do the changes that are mention after the emerge. But the bug is in the file the /etc/apache2/conf/modules.d/70_mod_php.conf

change the first line
<IfDefine PHP>
with the
<IfDefine PHP4>

That should work. if not let me know
_________________
Jignesh Donda
Back to top
View user's profile Send private message
Bruce
n00b
n00b


Joined: 27 Sep 2002
Posts: 50

PostPosted: Thu May 15, 2003 6:03 pm    Post subject: Reply with quote

After reading the posts on this thread and other similiar threads, I thought I'd put in my 2 cents. I spent 3 days screwing around with apache2 and PHP. I'm knew the modules were loaded because telneting to port 80 and requesting a page would yield the folllowing address:

Code:

<address>Apache/2.0.45 (Gentoo/Linux) mod_perl/1.99_08 Perl/v5.8.0 mod_ssl/2.0.45 OpenSSL/0.9.6i PHP/4.3.1 Server at www.foobar.com Port 80</address>


For some reason PHP would not parse the page so apache would simply serve up the PHP as if it was a normal document.

I read this thread several times but to be blunt I figured that some of the other posters had a screw loose because software just doesn't start working by itself.

Last night at 3 AM, I finally gave up. This morning when I got up, lo and behold, PHP started working. I even spent the last hour trying to make it fail (I can't).

Please add me to the list of people with a screw loose.
Back to top
View user's profile Send private message
SeraphWhisper
n00b
n00b


Joined: 16 May 2003
Posts: 13

PostPosted: Fri May 16, 2003 1:21 am    Post subject: magical apache... Reply with quote

following this thread and screwing around with apache, i think i figured out the secret...
for some reason, php only works after rebooting the whole system...although i have no idea why...
tried the following steps:
1) emerge apache
2) emerge php mod_php
3) added "APACHE_OPTS="-D PHP" to /etc/conf.d/apache2 (to account for the typo in 70_mod_php.conf )
4) rc-update add apache2 default

fired up apache2 and php still refused to work.....reboot once, there you go, magic....
unemerged it all and tried it again.....still doesn't work till i reboot....
*shrug* im completely stumped, but it works....
Back to top
View user's profile Send private message
jaloha
n00b
n00b


Joined: 07 Apr 2003
Posts: 35
Location: Honolulu, Hawai'i

PostPosted: Fri May 16, 2003 12:32 pm    Post subject: PHP just starts working? Reply with quote

Apahe has a lot of threads in action. I'm sure that something just needs to be restarted or updates itself after a period of time. That would explain the flaky behavior.
Back to top
View user's profile Send private message
momech
n00b
n00b


Joined: 19 May 2003
Posts: 3
Location: Kalundborg, Denmark

PostPosted: Tue May 20, 2003 6:06 pm    Post subject: err... Reply with quote

Err, i'm a newbie linux admin, BUT:
Could the aswer be that when you start apache with "apache(2)ctl start" it DOES NOT define the "PHP(4)" flag, whereas the init DOES define the "PHP(4)" flag?
That would explain why it suddenly starts working:
After messing around with apache(2)ctl for a lot of time you do a reboot/shutdown and - tada.wav - at boot init starts apache WITH the PHP(4)-flag...?
_________________
/Mogens - www.momech.dk
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
Page 1 of 1

 
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