Make WordPress Core

Opened 19 years ago

Closed 18 years ago

#1496 closed defect (bug) (wontfix)

wp-settings.php should dl() mysql.so if it's not loaded as an extension

Reported by: davidhouse's profile davidhouse Owned by: masquerade's profile masquerade
Milestone: Priority: low
Severity: minor Version: 2.0.2
Component: General Keywords: bg|squashed bg|commit
Focuses: Cc:

Description

People on debian and ubuntu are having problems with WordPress not picking up PHP's mySQL extension, because the extension_loaded('mysql') test is failing. However, this problem can be solved by dynamically loading the mySQL shared object file at runtime, using dl().

Patch:

--- wp-settings.php	2005-07-06 11:04:36.000000000 +0100
+++ wp-settings-new.php	2005-07-08 10:54:46.961662984 +0100
@@ -17,7 +17,8 @@
 	die( 'Your server is running PHP version ' . phpversion() . ' but WordPress requires at least 4.1' );
 
 if ( !extension_loaded('mysql') )
-	die( 'Your PHP installation appears to be missing the MySQL which is required for WordPress.' );
+	if ( !dl('mysql.so') )
+		die( 'Your PHP installation appears to be missing the MySQL which is required for WordPress.' );
 
 function timer_start() {
 	global $timestart;

See Also:

http://comox.textdrive.com/pipermail/wp-hackers/2005-April/000821.html
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=312721

Attachments (3)

dl.diff (1.1 KB) - added by masquerade 19 years ago.
dl-2.diff (1.2 KB) - added by davidhouse 18 years ago.
wp-settings-mysql-check-patch.diff (1.3 KB) - added by SteamedPenguin 18 years ago.
Fixed missing comma in last patch

Download all attachments as: .zip

Change History (14)

#1 @auroraeosrose
19 years ago

oh please don't do it that way, you'll royally screw windows users - the proper way is this (straight from the manual)

if (!extension_loaded('mysql')) {

$prefix = (PHP_SHLIB_SUFFIX == 'dll') ? 'php_' : ;
@dl($prefix . 'mysql.' . PHP_SHLIB_SUFFIX); }

you HAVE to error suppress the dl because there's no way to easily tell if a server is TS (thread safe) and dl will spit out a warning if it is - can I get someone to fix the diff? I'm too lazy

#2 @masquerade
19 years ago

  • Keywords bg|squashed bg|commit added
  • Owner changed from anonymous to masquerade

Both of the above methods are insufficient. I've made a patch that should work where its possible, and still die out where its not. Marking for commit

@masquerade
19 years ago

#3 @matt
19 years ago

Should this really say sqlite at the end of the patch?

#4 @shovel
18 years ago

Yes, sqlite isn't a supported dblib under wp.

@davidhouse
18 years ago

#5 @davidhouse
18 years ago

I think the version comparison was wrong as well: the manual says dl() is deprecated in 5.0+, so we should check to see if we're >= 5.0 and die if so, masquerade's patch had this backwards.

Patch attached which fixes both issues.

@SteamedPenguin
18 years ago

Fixed missing comma in last patch

#6 @SteamedPenguin
18 years ago

Please test latest patch: wp-settings-mysql-check-patch.diff

#7 @SteamedPenguin
18 years ago

wp-settings-mysql-check-patch.diff also works for WP 1.5 codebase. Please consider for backport to 1.5 branch

#8 @davidhouse
18 years ago

  • Priority changed from normal to low
  • Severity changed from normal to minor
  • Version changed from 1.6 to 2.0.2

If we have another release on the 1.5 branch, we could incorporate this. Not nearly a big enough issue to warrant a release on its own though.

#9 @SteamedPenguin
18 years ago

On its own, no, but there are some additions to the 1.5 branch that are adding up to another 1.5 release. Maybe not a 1.5.3, but a 1.5.2.1 wouldn't hurt.

#10 @ryan
18 years ago

Resurrecting this one...

Do we give Debian users the convenience of dl() even though it is being deprecated and is a performance killer?

#11 @ryan
18 years ago

  • Resolution set to wontfix
  • Status changed from new to closed

Ubuntu installs everything correctly these days. Won't fix.

Note: See TracTickets for help on using tickets.