Ticket #1496 (closed defect (bug): wontfix)

Opened 7 years ago

Last modified 5 years ago

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

Reported by: davidhouse Owned by: masquerade
Priority: low Milestone:
Component: General Version: 2.0.2
Severity: minor Keywords: bg|squashed bg|commit
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

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

Change History

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

  • 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

comment:3   matt6 years ago

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

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

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.

Fixed missing comma in last patch

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

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

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

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.

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.

Resurrecting this one...

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

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

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

Note: See TracTickets for help on using tickets.