Make WordPress Core

Opened 15 years ago

Closed 15 years ago

#11604 closed defect (bug) (duplicate)

apache_mod_loaded() is broken

Reported by: hakre's profile hakre Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.9
Component: General Keywords: 2nd-opinion dev-feedback
Focuses: Cc:

Description

While reviewing a patch in #10365 which containted the apache_mod_loaded function it just came to my mind that it might be broken.

Therefore I tested that function by looking for mod_rewrite on a server which has mod_rewrite enabled. The test failed, apache_mod_loaded() returned false.

test code: var_dump(apache_mod_loaded('mod_rewrite'));

It looks like that parsing the output of phpinfo(8) for the apache module name is bogus in my eyes.

Change History (8)

#1 @sivel
15 years ago

  • Keywords 2nd-opinion added; needs-patch removed

Not sure I understand, first the function attempts to use apache_get_modules (which was introduced in php 4.3.2), and if that function doesn't exist then it tries to check in phpinfo to see if it can find mod_rewrite in there, which if using mod_php with apache you should see that.

So looking at phpinfo is the fall back. From what I can tell, other than apache_get_modules, which is the first choice, there really isn't a better alternative for a fall back.

I guess in the end it all stems back to the possibility that the php install was done in a way that it can not get that information from apache, usually this being fastcgi.

Just not sure what else we could do.

#2 @westi
15 years ago

  • Keywords reporter-feedback added

I assume that apache_get_modules is failing in PHP 4 because of this?

From php.net changelog for this function:

5.0.0 Became available when using Apache 1, or the PHP Apache 2 filter API. Before this time, it was only available when using the Apache 2 handler API.

What PHP version? What server config for Apache (and what version)?

#3 @hakre
15 years ago

  • Keywords dev-feedback added; reporter-feedback removed

For clarification:

  1. apache_get_modules function does not work in CGI/FCGI. FCGI is the weapon of choice when it comes to propper PHP hosting for most of the pros.
  2. the fallback is broken. so there actually is no fallback.
  3. taking 1.) and 2.) into account, the overall function is broken for CGI/FCGI.

Just clarify if you want to have CGI/FCGI supported in wordpress core or not.

#4 @sivel
15 years ago

See also #11848

#5 @nacin
15 years ago

  • Milestone 3.0 deleted
  • Resolution set to worksforme
  • Status changed from new to closed

#6 @Denis-de-Bernardy
15 years ago

  • Milestone set to 3.0
  • Resolution worksforme deleted
  • Status changed from closed to reopened

Re-opening this, because it doesn't work for me. :-P

Using fastcgi, the fact of the matter is that apache_mod_loaded() does not work at all.

#7 @nacin
15 years ago

Really, the fact of the matter is that using fastcgi, apache_get_modules() will not work at all.

#8 @dd32
15 years ago

  • Milestone 3.0 deleted
  • Resolution set to duplicate
  • Status changed from reopened to closed

As nacin said, This function simply cannot operate under fastcgi. There is nothing that can be fixed here.

The result of the function should always be treated as "Yes, that functionality exists" or "Not sure if its enabled or not". Anything which relies on a boolean result from the function should be updated. Closing as duplicate of #11848

Note: See TracTickets for help on using tickets.