Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

Apache 2.2 + PHP 5.2 = Broke

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
37 posts
  • 1
  • 2
  • Next
Author
Message
tsuehpsyde
Tux's lil' helper
Tux's lil' helper
Posts: 103
Joined: Wed Jul 28, 2004 2:03 pm
Contact:
Contact tsuehpsyde
Website

Apache 2.2 + PHP 5.2 = Broke

  • Quote

Post by tsuehpsyde » Wed May 09, 2007 12:26 am

Okay, so I've been happily running apache 2.0.59 and PHP 5.2.2, and of course 2007.0 comes out, bringing with it Apache 2.2. I happily compile the update, and restart apache to find out it won't restart (not surprising, happens a lot with apache with updates it seems). So I restart the server and manually start apache. First thing I notice is that PHP isn't working. Okay, so I add -D PHP5 into /etc/conf.d/apache2, and it gives this error on startup:

Code: Select all

 * Apache2 has detected a syntax error in your configuration files:
apache2: Syntax error on line 495 of /etc/apache2/httpd.conf: Syntax error on line 5 of /etc/apache2/modules.d/70_mod_php5.conf: API module structure `php5_module' in file /usr/lib/apache2/modules/libphp5.so is garbled - perhaps this is not an Apache module DSO?
Okay, I re-check the file and realize, I don't see a PHP option anymore. Odd. So I recompile php to find this error:

Code: Select all

Calculating dependencies... done!
>>> Verifying ebuild Manifests...

>>> Emerging (1 of 1) dev-lang/php-5.2.2-r1 to /
 * php-5.2.2.tar.bz2 RMD160 ;-) ...                                                                                                                    [ ok ]
 * php-5.2.2.tar.bz2 SHA1 ;-) ...                                                                                                                      [ ok ]
 * php-5.2.2.tar.bz2 SHA256 ;-) ...                                                                                                                    [ ok ]
 * php-5.2.2.tar.bz2 size ;-) ...                                                                                                                      [ ok ]
 * php-patchset-5.2.2-r2.tar.bz2 RMD160 ;-) ...                                                                                                        [ ok ]
 * php-patchset-5.2.2-r2.tar.bz2 SHA1 ;-) ...                                                                                                          [ ok ]
 * php-patchset-5.2.2-r2.tar.bz2 SHA256 ;-) ...                                                                                                        [ ok ]
 * php-patchset-5.2.2-r2.tar.bz2 size ;-) ...                                                                                                          [ ok ]
 * checking ebuild checksums ;-) ...                                                                                                                   [ ok ]
 * checking auxfile checksums ;-) ...                                                                                                                  [ ok ]
 * checking miscfile checksums ;-) ...                                                                                                                 [ ok ]
 * checking php-5.2.2.tar.bz2 ;-) ...                                                                                                                  [ ok ]
 * checking php-patchset-5.2.2-r2.tar.bz2 ;-) ...                                                                                                      [ ok ]
 * Determining SAPI(s) to build
 *   Enabled  SAPI: cli
 *   Disabled SAPI: cgi
 *   Disabled SAPI: apache
 *   Enabled  SAPI: apache2
 *
 * If this package fails with a fatal error about Apache2 not having
 * been compiled with a compatible MPM, this is normally because you
 * need to toggle the 'threads' USE flag.
 *
 * If 'threads' is off, try switching it on.
 * If 'threads' is on, try switching it off.
 *
/usr/portage/eclass/apache-module.eclass: line 243: //usr/sbin/apxs2: No such file or directory
 * The module you are trying to install (php)
 * will only work with one of the following MPMs:
 *    itk peruser prefork
 * You do not currently have any of these MPMs installed.
 * Please re-install apache with the correct mpm-* USE flag set.

!!! ERROR: dev-lang/php-5.2.2-r1 failed.
Call stack:
  ebuild.sh, line 1631:   Called dyn_setup
  ebuild.sh, line 703:   Called qa_call 'pkg_setup'
  ebuild.sh, line 44:   Called pkg_setup
  php-5.2.2-r1.ebuild, line 64:   Called apache-module_pkg_setup
  apache-module.eclass, line 374:   Called apache2_pkg_setup
  apache-module.eclass, line 255:   Called die

!!! No safe MPM installed.
!!! If you need support, post the topmost build error, and the call stack if relevant.
!!! A complete build log is located at '/var/tmp/portage/dev-lang/php-5.2.2-r1/temp/build.log'.
So I add mpm-prefork to my USE flags, and run emerge -uDaN world, and viola, apache recompiles with the new USE flag. I'll add that mpm-prefork is the default MPM apache2 uses if none are specified in make.conf, but I figured it must be keeping track somewhere, so I'll just go ahead and recompile with the use flag for shits and giggles. So it re-emerges, installes, I restart apache, and re-emerge PHP. Yet, this time, it still brings up the same error.

Do I have something misconfigured here? I'm assuming PHP compiles against apache, hense why I tried to recompile to see if I could then start apache with the php5 OPTS flag.

I'm just glad I ran this on my webserver that only hosts my blog atm. I'd be crying if this happened on my main webserver.

Edit: Here you can see that mpm-prefork is being used:

Code: Select all

server2 modules.d # emerge -av apache

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R   ] net-www/apache-2.2.4  USE="mpm-prefork ssl -debug -doc -ldap -mpm-event -mpm-peruser -mpm-worker -no-suexec (-selinux) -static-modules -threads" 0 kB

Total: 1 package (1 reinstall), Size of downloads: 0 kB

Would you like to merge these packages? [Yes/No]
Top
rorsten
n00b
n00b
Posts: 7
Joined: Wed May 05, 2004 10:39 am

  • Quote

Post by rorsten » Wed May 09, 2007 12:33 am

I am crying, this happened on my development staging server and I've lost half a day's billable time trying to fix it.
Top
tsuehpsyde
Tux's lil' helper
Tux's lil' helper
Posts: 103
Joined: Wed Jul 28, 2004 2:03 pm
Contact:
Contact tsuehpsyde
Website

  • Quote

Post by tsuehpsyde » Wed May 09, 2007 1:18 am

rorsten wrote:I am crying, this happened on my development staging server and I've lost half a day's billable time trying to fix it.
That's why it's staging and not production. ;) But yeah, this seems like a pretty obvious bug on a widely used package, and I can't find any other references to it. Anyone have any ideas?
Top
Tron_5
n00b
n00b
Posts: 13
Joined: Wed May 19, 2004 5:00 pm

  • Quote

Post by Tron_5 » Wed May 09, 2007 1:39 am

Having the same problem. :evil:
Top
zach9824
n00b
n00b
User avatar
Posts: 37
Joined: Mon Apr 12, 2004 1:10 am

  • Quote

Post by zach9824 » Wed May 09, 2007 1:43 am

Same here. Did anyone open a bug report yet. This is pretty major.
Top
lorenb
Apprentice
Apprentice
User avatar
Posts: 207
Joined: Sat Aug 24, 2002 4:25 am
Location: Toronto, ON

  • Quote

Post by lorenb » Wed May 09, 2007 1:44 am

PHP is looking for /usr/sbin/apxs2 which doesn't exist with apache 2.2. It's just called /usr/sbin/apxs now. I'm not sure if that is a build issue or the Apache guys changed it.

To work around that, I just made a symlink:

Code: Select all

cd /usr/sbin
ln -s apxs apxs2
I was able to recompile PHP and subversion without any errors. Apache would start after that, although I discovered that Apache 2.2 is more strict about permissions.

UPDATE: I found bug #177697 about this issue.
Top
zach9824
n00b
n00b
User avatar
Posts: 37
Joined: Mon Apr 12, 2004 1:10 am

  • Quote

Post by zach9824 » Wed May 09, 2007 1:54 am

You got there before I did. And BTW, thanks that seems to work.

Never a good day when PHP/Apache both get updates on the same day...
Top
tsuehpsyde
Tux's lil' helper
Tux's lil' helper
Posts: 103
Joined: Wed Jul 28, 2004 2:03 pm
Contact:
Contact tsuehpsyde
Website

  • Quote

Post by tsuehpsyde » Wed May 09, 2007 2:40 am

Okay, I've recompiled PHP but now I've run into another (quite common) problem.

Code: Select all

server2 sbin # /etc/init.d/apache2 start
 * WARNING:  apache2 has already been started.
server2 sbin # /etc/init.d/apache2 restart
 * Stopping apache2 ...
No /usr/sbin/apache2 found running; none killed.                                                                                                       [ !! ]
server2 sbin #
I'm removed the /var/run/apache2.pid file as well as ran killall -9 apache2 (it does this when the server is running, generally after an apache update, this has been happening even before 2.2). What else do I have to do to reset apache2's status? Generally I reboot the server, but considering this server also hosts two high traffic game server, I can't get away with that too much. :) Already did it once tonight.

I also do this testing on a home server as well (my dev server, if you will), but I have to note every step to make sure I don't run into this error. Generally, shutting the server down prior to the upgrade fixes it, but I can't really afford the downtime of apache while it's compiling (and I'd rather not do the package build work around like postfix unless I have to).

Anyone got any ideas?
Top
i92guboj
Bodhisattva
Bodhisattva
User avatar
Posts: 10315
Joined: Tue Nov 30, 2004 8:17 pm
Location: Córdoba (Spain)

  • Quote

Post by i92guboj » Wed May 09, 2007 2:52 am

zach9824 wrote:You got there before I did. And BTW, thanks that seems to work.

Never a good day when PHP/Apache both get updates on the same day...
The fact is that, being two pieces that work together, they often get updated together as well, at least, in my own experience. Anyway, the thing has the ln workaround for now. There's a bug in bugzilla since some hours ago as well.
tsuehpsyde wrote:Okay, I've recompiled PHP but now I've run into another (quite common) problem.

Code: Select all

server2 sbin # /etc/init.d/apache2 start
 * WARNING:  apache2 has already been started.
server2 sbin # /etc/init.d/apache2 restart
 * Stopping apache2 ...
No /usr/sbin/apache2 found running; none killed.                                                                                                       [ !! ]
server2 sbin #
I'm removed the /var/run/apache2.pid file as well as ran killall -9 apache2 (it does this when the server is running, generally after an apache update, this has been happening even before 2.2). What else do I have to do to reset apache2's status? Generally I reboot the server, but considering this server also hosts two high traffic game server, I can't get away with that too much. :) Already did it once tonight.

I also do this testing on a home server as well (my dev server, if you will), but I have to note every step to make sure I don't run into this error. Generally, shutting the server down prior to the upgrade fixes it, but I can't really afford the downtime of apache while it's compiling (and I'd rather not do the package build work around like postfix unless I have to).

Anyone got any ideas?
/etc/init.d/apache zap
killall -s9 apache
/etc/init.d/apacher start

Should work, if not, better reboot.
Top
tsuehpsyde
Tux's lil' helper
Tux's lil' helper
Posts: 103
Joined: Wed Jul 28, 2004 2:03 pm
Contact:
Contact tsuehpsyde
Website

  • Quote

Post by tsuehpsyde » Wed May 09, 2007 3:02 am

Awesome. :D That fixed it. I've never heard of the zap option, but that is definitely going to come in handly. I guess I shoulda checked the syntax sooner. :) Now to fix permissions on my vhost which seem to have broken.
Top
dblaci
n00b
n00b
Posts: 30
Joined: Tue Oct 05, 2004 12:02 pm
Contact:
Contact dblaci
Website

  • Quote

Post by dblaci » Wed May 09, 2007 7:49 am

The symlink solved the problem. Thanks.
Top
robostac
n00b
n00b
Posts: 34
Joined: Tue Aug 26, 2003 10:41 am

  • Quote

Post by robostac » Wed May 09, 2007 3:46 pm

Symlink fixed it for me too. Thanks!
Top
zwik
Apprentice
Apprentice
User avatar
Posts: 167
Joined: Sun Sep 08, 2002 8:11 pm
Location: NL, NB, Liempde
Contact:
Contact zwik
Website

  • Quote

Post by zwik » Thu May 10, 2007 11:48 am

That symlink is just a dirty work-around. In the new revision R1 of apache this is fixed. Now Subversion and modperl will compile just fine aswell.
Daily life and stuff.
Top
ianwilder
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 121
Joined: Fri Apr 30, 2004 4:57 pm
Location: georgia.usa.earth

  • Quote

Post by ianwilder » Thu May 10, 2007 1:49 pm

all the -r1 did was symlink the binary.

in Bug 177697:

------- Comment #8 From Bryan Østergaard 2007-05-09 12:56:34 0000 [reply] -------

I've added symlinks for all the commands that used to be called *2 in
apache-2.2.4-r1 and apache-tools-2.2.4-r1. In time we'll go through eclasses
and ebuilds and fix them to use the proper names but for now symlinks seems to
be the best solution.
Top
moocha
Watchman
Watchman
Posts: 5722
Joined: Tue Oct 21, 2003 6:45 pm

  • Quote

Post by moocha » Sun May 13, 2007 5:00 pm

rorsten wrote:I am crying, this happened on my development staging server and I've lost half a day's billable time trying to fix it.
Erm.

Code: Select all

caribou ~ # emerge -pv ">=net-www/apache-2.2.0"

These are the packages that would be merged, in order:

Calculating dependencies /
!!! All ebuilds that could satisfy ">=net-www/apache-2.2.0" have been masked.
!!! One of the following masked packages is required to complete your request:
- net-www/apache-2.2.4-r1 (masked by: ~x86 keyword)
- net-www/apache-2.2.4 (masked by: ~x86 keyword)

For more information, see MASKED PACKAGES section in the emerge man page or
refer to the Gentoo Handbook.

Code: Select all

caribou ~ # emerge --info|head -n1
Portage 2.1.2.2 (default-linux/x86/2007.0/server, gcc-4.1.1, glibc-2.5-r2, 2.6.17-hardened-r1 i686)

Code: Select all

caribou ~ # grep KEYWORDS /usr/portage/net-www/apache/apache-2.2*
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
In other words, no apache-2.2 ebuild is keyworded stable. In other words, you're running an unstable package on a system you're using in production ("in production" being defined as "if something breaks, it costs money"). That's... disingenious.
I'm hard pressed for sympathy there. On the other hand, consider this a valuable lesson.
Military Commissions Act of 2006: http://tinyurl.com/jrcto

"Those who would give up essential liberty to purchase a little temporary safety deserve neither liberty nor safety."
-- attributed to Benjamin Franklin
Top
tsuehpsyde
Tux's lil' helper
Tux's lil' helper
Posts: 103
Joined: Wed Jul 28, 2004 2:03 pm
Contact:
Contact tsuehpsyde
Website

  • Quote

Post by tsuehpsyde » Mon May 14, 2007 2:33 pm

Aside from this issue, I've noticed that the update to 2.2 has broken my vhosting on apache? :( Nothing has changed, and using the /var/www/localhost/htdocs/ folder still works 100%, but vhosts all come up with the 403 error stating

Code: Select all

Forbidden

You don't have permission to access / on this server.
Any ideas? It's got to be a config problem as I can take one folder (call it web1) and make it /var/www/localhost/htdocs and it works fine, but if I move the same dir to say /var/www/vhost and add a host for it, apache gives the above error. The configs haven't changed at all since 2.0.59, so something is wonky somewhere, but I can't seem to track it down.

Anyone have any ideas? I could use a lil' help since I use vhosts for all of my domains. :) Need to get 2.2 onto my main server.
Top
moocha
Watchman
Watchman
Posts: 5722
Joined: Tue Oct 21, 2003 6:45 pm

  • Quote

Post by moocha » Mon May 14, 2007 2:41 pm

Does anything related appear in apache's error logs around the time those requests were made?
Military Commissions Act of 2006: http://tinyurl.com/jrcto

"Those who would give up essential liberty to purchase a little temporary safety deserve neither liberty nor safety."
-- attributed to Benjamin Franklin
Top
tsuehpsyde
Tux's lil' helper
Tux's lil' helper
Posts: 103
Joined: Wed Jul 28, 2004 2:03 pm
Contact:
Contact tsuehpsyde
Website

  • Quote

Post by tsuehpsyde » Mon May 14, 2007 3:09 pm

moocha wrote:Does anything related appear in apache's error logs around the time those requests were made?

Code: Select all

[Wed May 09 15:10:12 2007] [notice] Apache/2.2.4 (Unix) DAV/2 mod_ssl/2.2.4 OpenSSL/0.9.8e configured -- resuming normal operations
[Wed May 09 15:10:18 2007] [error] [client 66.135.x.x] client denied by server configuration: /var/www/host.com/
Not too detailed, just blames the configs, but my vhost configs are very simple:

Code: Select all

tsuehpsyde@server2 ~ $ cat /etc/apache2/vhosts.d/host.com.conf 
<VirtualHost *:80>
ServerName host.com
ServerAlias host.com
DocumentRoot /var/www/host.com/
</VirtualHost>
tsuehpsyde@server2 ~ $ 
Ideas?
Top
tsuehpsyde
Tux's lil' helper
Tux's lil' helper
Posts: 103
Joined: Wed Jul 28, 2004 2:03 pm
Contact:
Contact tsuehpsyde
Website

  • Quote

Post by tsuehpsyde » Mon May 14, 2007 7:44 pm

Any ideas? I checked the docs for Apache 2.2 and vhosting looks identical to 2.0? :?
Top
neysx
Retired Dev
Retired Dev
User avatar
Posts: 795
Joined: Mon Jan 27, 2003 10:16 am
Contact:
Contact neysx
Website

  • Quote

Post by neysx » Mon May 14, 2007 8:02 pm

Look for the following in /etc/apache2/httpd.conf and comment it out:

Code: Select all

# First, we configure the "default" to be a very restrictive set of 
# features.  
#
#<Directory />
#    Options FollowSymLinks
#    AllowOverride None
#    Order deny,allow
#    Deny from all
#</Directory>
Hth
Top
tsuehpsyde
Tux's lil' helper
Tux's lil' helper
Posts: 103
Joined: Wed Jul 28, 2004 2:03 pm
Contact:
Contact tsuehpsyde
Website

  • Quote

Post by tsuehpsyde » Tue May 15, 2007 2:22 am

Thank you very much! :) That did it. Now to upgrade the main box and pray I didn't forget any steps. :lol:
Top
niuck
n00b
n00b
User avatar
Posts: 60
Joined: Wed Mar 16, 2005 1:29 pm

  • Quote

Post by niuck » Sun May 27, 2007 1:54 pm

I dont even have apxs so i have nothing to symlink. I re-compiled apache with
[ebuild R ] net-www/apache-2.2.4-r3 USE="ldap mpm-prefork ssl -debug -doc -mpm-event -mpm-itk -mpm-peruser -mpm-worker -no-suexec (-selinux) -static-modules -threads" 0 kB

Any idea why it's gone?
Top
irondog
l33t
l33t
User avatar
Posts: 715
Joined: Mon Jul 07, 2003 1:41 pm
Location: Voor mijn TV. Achter mijn pc.

  • Quote

Post by irondog » Sun May 27, 2007 2:45 pm

niuck wrote:I dont even have apxs so i have nothing to symlink. I re-compiled apache with
[ebuild R ] net-www/apache-2.2.4-r3 USE="ldap mpm-prefork ssl -debug -doc -mpm-event -mpm-itk -mpm-peruser -mpm-worker -no-suexec (-selinux) -static-modules -threads" 0 kB

Any idea why it's gone?
Same problem here. Apache 2.2 doesn't install the apxs2 binary. Yet another bug.

I posted a bug report:
https://bugs.gentoo.org/show_bug.cgi?id=180006
Alle dingen moeten onzin zijn.
Top
115552
Tux's lil' helper
Tux's lil' helper
Posts: 108
Joined: Tue Aug 09, 2005 11:35 am

  • Quote

Post by 115552 » Wed Aug 01, 2007 8:54 am

This happened to me too.

I noticed that in the apache2 upgrade a few days ago, the 'threads' flag was enabled in it for some reason. This is why mine borked. (there are a lot of problems with compiling apache with threads).

So i just made sure my apache line in package.use is not changed, recompiled apache2 with -threads, then went on to recompile php. That did the job for me.
Top
tsuehpsyde
Tux's lil' helper
Tux's lil' helper
Posts: 103
Joined: Wed Jul 28, 2004 2:03 pm
Contact:
Contact tsuehpsyde
Website

  • Quote

Post by tsuehpsyde » Thu Aug 02, 2007 9:53 pm

neysx wrote:Look for the following in /etc/apache2/httpd.conf and comment it out:

Code: Select all

# First, we configure the "default" to be a very restrictive set of 
# features.  
#
#<Directory />
#    Options FollowSymLinks
#    AllowOverride None
#    Order deny,allow
#    Deny from all
#</Directory>
Hth
This line is no longer found in /etc/apache2/httpd.conf on the latest update to apache www-servers/apache-2.2.4-r11. However, this same behavior has returned, blocking my vhosts from being loaded saying denied. I checked the default vhost files as well, but I'm overlooking something somewhere. Anyone have any ideas? :(
Top
Post Reply

37 posts
  • 1
  • 2
  • Next

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic