Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 481190 - dev-lang/php: building +pdo +mysqli -mysql does not include pdo-mysql
Summary: dev-lang/php: building +pdo +mysqli -mysql does not include pdo-mysql
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Normal normal with 3 votes (vote)
Assignee: PHP Bugs
URL:
Whiteboard:
Keywords:
: 556364 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-08-15 15:44 UTC by Stef Simoens
Modified: 2022-05-10 19:49 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
proposed patch (php-5.4.17.ebuild-mysqli.patch,626 bytes, patch)
2013-08-15 15:46 UTC, Stef Simoens
Details | Diff
trivial ebuild patch (php-mysqli.ebuild.patch,813 bytes, patch)
2013-10-07 22:54 UTC, Stef Simoens
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stef Simoens 2013-08-15 15:44:57 UTC
the current ebuilds do not handle the "pdo mysqli -mysql -mysqlnd" USE flags

the support for pdo-mysql is not included

Reproducible: Always

Steps to Reproduce:
USE="pdo mysqli -mysqlnd -mysql" emerge php
Actual Results:  
php is configured as (redacted) 
configure --enable-pdo --without-pdo-dblib --without-pdo-mysql --without-pdo-pgsql --without-pdo-sqlite --without-pdo-odbc 

Expected Results:  
php is configured as (redacted) 
configure --enable-pdo --without-pdo-dblib --with-pdo-mysql=/usr --without-pdo-pgsql --without-pdo-sqlite --without-pdo-odbc 

a patch like this (for php-5.4.17.ebuild) could be an option (also attached for your patching pleasure)

--- /usr/portage/dev-lang/php/php-5.4.17.ebuild	2013-07-31 16:31:09.000000000 +0200
+++ /usr/local/portage/dev-lang/php/php-5.4.17.ebuild	2013-08-15 17:28:02.263174352 +0200
@@ -496,14 +496,17 @@
 	# PDO support
 	if use pdo ; then
 		my_conf+="
 		$(use_with mssql pdo-dblib )"
 		if use mysqlnd ; then
 			my_conf+="
 			$(use_with mysqlnd pdo-mysql mysqlnd)"
+		elif use mysqli ; then
+			my_conf+="
+			$(use_with mysqli pdo-mysql ${EPREFIX}/usr)"
 		else
 			my_conf+="
 			$(use_with mysql pdo-mysql ${EPREFIX}/usr)"
 		fi
 		my_conf+="
 		$(use_with postgres pdo-pgsql )
 		$(use_with sqlite pdo-sqlite ${EPREFIX}/usr)
Comment 1 Stef Simoens 2013-08-15 15:46:35 UTC
Created attachment 356090 [details, diff]
proposed patch
Comment 2 Ole Markus With (RETIRED) gentoo-dev 2013-08-16 07:35:47 UTC
This is intentional. mysqli and mysql are not equivalent USE flags with regards to pdo.
Comment 3 Stef Simoens 2013-08-16 07:47:47 UTC
okay ... and so how does one compile php WITH pdo WITH mysqli WITHOUT mysql ?
I currently made my own ebuild, and it works ... would be nice to have it working without having to do that.
Comment 4 Ole Markus With (RETIRED) gentoo-dev 2013-08-16 08:01:11 UTC
Continue using your ebuild. I cannot think of any valid use case for not having mysql enabled. Not like those functions do any harm.
Comment 5 Stef Simoens 2013-10-07 22:46:54 UTC
Requesting re-evaluation due to: https://wiki.php.net/rfc/mysql_deprecation

Bottom line: mysql is deprecated in php-5.5

Currently, it is not possible to `emerge USE="mysqli -mysql" php`, even though the ebuild can be changed to allow this.
Comment 6 Stef Simoens 2013-10-07 22:54:35 UTC
Created attachment 360360 [details, diff]
trivial ebuild patch

patch to current php-5.5.4.ebuild
Comment 7 Cifer 2015-01-10 13:36:35 UTC
Still unfixed?

Now the official PHP Manual also states that:

"This extension is deprecated as of PHP 5.5.0, and is not recommended for writing new code as it will be removed in the future. "

where "This extension" refers to mysql.

http://php.net/manual/en/intro.mysql.php

I'd like @Simoens's patch can be merged.
Comment 8 Michael Orlitzky gentoo-dev 2015-01-10 15:33:43 UTC
We're sort of stuck here because we don't want to use the wrong names, and "mysql" is the global USE flag for "mysql support", whatever that means. So,

 * We don't want to create a new USE flag pdo-mysql; if people have USE=mysql 
   and USE=pdo, they should get it. That's what people expect from the global
   flag.

 * We don't want to create a separate USE flag for the deprecated mysql support; 
   if people have USE=mysql, they should get it. Moreover this would break 
   thousands of websites as upgrades accidentally removed the deprecated mysql 
   support.

 * The mysqli driver is a specific, non-PDO driver, so I don't think it makes 
   sense as a user interface to have pdo+mysqli == pdo-mysql.

I'd like to fix this too, but none of the options are very good. The issue will go away eventually when we can drop the deprecated mysql support.

@olemarkus: we might be able to introduce a IUSE=+deprecated flag that would override the other USE flags. If USE=-deprecated, would could force-disable the old mysql support near the end of the config phase regardless of the other flags.
Comment 9 Ole Markus With (RETIRED) gentoo-dev 2015-01-12 08:24:32 UTC
> @olemarkus: we might be able to introduce a IUSE=+deprecated flag that would
> override the other USE flags. If USE=-deprecated, would could force-disable
> the old mysql support near the end of the config phase regardless of the
> other flags.

Sounds a little bit complicated ...

Seems like PHP 7 will have ext/mysql removed so we can change the meaning of the USE flags from then on. PHP 7 will, if all goes according to plan, be released over the summer.
Comment 10 Jake 2015-01-12 14:50:03 UTC
Why not just have PDO-specific USE flags for all PDO drivers and conditionally flip them if both the database and pdo USE flags are enabled?  This would make it possible to have "pdo pdo-mysql -mysql -mysqli" and any combination of enabled-disabled of the various PHP MySQL USE flags, because the PDO driver and the MySQLi and deprecated MySQL options are all non-dependent on each other.

As for the handling of the global mysql flag, why not have that linked to the MySQLi driver and add a new "oldmysql" flag or something similar for PHP >= 5.5 and < PHP 7?

Just some thoughts.
Comment 11 Cifer 2015-01-12 16:10:00 UTC
(In reply to Michael Orlitzky from comment #8)

> 
>  * The mysqli driver is a specific, non-PDO driver, so I don't think it
> makes 
>    sense as a user interface to have pdo+mysqli == pdo-mysql.
> 

As far as i am concern, in PHP, mysql, mysqli and pdo-mysql are three individual extensions, each of them are based on libmysql or mysqlnd low-level driver individually.

I means, mysql, mysqli, PDOs (include pdo-mysql, pdo-sqlite, ...) are parallel, they all have their own directory in PHP source code: ext/mysql, ext/mysqli, ext/pdo, ext/pdo_mysql, ...

So, if pdo + mysqli != pdo-mysql, why should pdo + mysql == pdo-mysql? After all, pdo-mysql extension has nothing to do with the mysql extension, either.

I agree with @Jake that "having PDO-specific USE flags for all PDO drivers", in this way, we can just get the pdo-mysql extension with "pdo pdo-mysql -mysql -mysqli". After all, why I must be imposed mysql extension if I just need pdo-mysql extension?
Comment 12 Michael Orlitzky gentoo-dev 2015-01-12 19:10:08 UTC
I'm only guessing, but it's easy to imagine how the pdo+mysql thing came to be. PHP has a --disable-pdo configure flag that maps naturally to a USE=pdo flag. So the "pdo" USE flag is there. And once you have PDO enabled, the global mysql USE flag has description "Add mySQL Database support." So if you have both, it makes sense to enable pdo-mysql.

I would be OK with having separate pdo-mysql, pdo-pgsql, etc. flags but doing that would require big changes to the ebuild and a lot of retesting. Versus the alternative of do nothing and wait six months =)

I'll work on the ebuild and see how big of a pain it would be.

There is a good reason to want this: suppose you manage a server for a group of web developers. You've told them that the deprecated MySQL support is going away, and they've finally cleaned up their code base after a few years and you're sure that no existing websites use the old driver. In preparation for php-7, you'd like to disable the old MySQL support NOW so that if any developer tries to push code using the old driver, it breaks immediately. If you leave those "harmless" functions enabled, you can be sure one of them will ignore you and write a new site using the old driver.
Comment 13 Leho Kraav (:macmaN @lkraav) 2016-01-10 17:54:32 UTC
Aha, so this surprised me as well today, on PHP7. Glad to see a bunch of discussion already done.

But I guess there's wasn't much motivation in getting this cleaned up historically, but now with PHP7 being real perhaps...?
Comment 14 Michael Orlitzky gentoo-dev 2016-01-11 13:29:46 UTC
(In reply to Leho Kraav (:macmaN @lkraav) from comment #13)
> 
> But I guess there's wasn't much motivation in getting this cleaned up
> historically, but now with PHP7 being real perhaps...?

We're stuck between a rock and a hard place here.

The first issue is that USE flags in Gentoo are supposed to be "feature" flags and not "implementation" flags. This makes sense for desktop applications, but not so much for programming languages where the users are often developers. If we think of "mysql" as a feature flag, it should enable mysql, mysqli, and pdo-mysql -- but then someone will (rightly) complain that they want to enable only a subset of those drivers.

My own personal wish is that they were separated into three USE flags from the beginning: USE=mysql, USE=mysqli, and USE=pdo-mysql. That violates the USE flag policy, but I think the resulting predictable behavior is worth the shame. However, changing it now is going to cause other problems. If we switch around the meanings of the USE flags, it's going to break a lot of installations. We would need to accompany it with a news item and a lot of testing. It would also require us to re-stabilize everything, and for a time we might have incorrect flag descriptions in metadata.xml.

It's at that point that I lose motivation. There are so many other bugs open that won't be such a pain to fix. If somebody else wanted to do it I'd give them the thumbs up though.
Comment 15 Leho Kraav (:macmaN @lkraav) 2016-01-11 13:32:43 UTC
(In reply to Michael Orlitzky from comment #14)
> 
> It's at that point that I lose motivation. There are so many other bugs open
> that won't be such a pain to fix. If somebody else wanted to do it I'd give
> them the thumbs up though.

Totally true. I think I'll gladly live with this minor optimization leak instead of trying to make the world a worse place as a whole by trying to take away work from far more valuable stuff.
Comment 16 Brian Evans (RETIRED) gentoo-dev 2016-01-11 13:44:39 UTC
My suggestion would be to drop the USE=mysqli.
This makes USE=mysql be the feature enable for mysqli extension (and mysql extension <7.0) and pair it with USE=pdo to enable pdo-mysql.

Yes, it can be somewhat of a pain, but there are worse alternatives.

Only a handful other packages refer to USE=mysqli

dev-db/phpmyadmin
dev-php/PEAR-MDB2
dev-php/PEAR-MDB2_Driver_mysqli
dev-php/pecl-mysqlnd_ms
dev-php/pecl-mysqlnd_qc
mail-client/roundcube
www-apps/drupal
www-apps/eyeos
www-apps/gallery (masked for removal)
www-apps/groupoffice
www-apps/moodle
www-apps/postfixadmin
www-apps/sugarcrm
www-apps/wordpress
www-misc/zoneminder
Comment 17 jorgicio 2016-05-08 02:10:42 UTC
I had the same issue, and I think is a good idea to add the belonging USE-flag both for mysql and postgres (when pdo USE-flag is enabled, only enables sqlite).
Meanwhile, I had to do the following:

Create a file (I named it pdo_mysql.conf) into /etc/portage/env. Its content must be:
EXTRA_ECONF="--with-pdo-mysql"

Then, in /etc/portage/package.env/env, I added the line:

dev-lang/php pdo_mysql.conf

Then, rebuild php.
Comment 18 Michael Orlitzky gentoo-dev 2016-07-12 15:06:35 UTC
*** Bug 556364 has been marked as a duplicate of this bug. ***
Comment 19 Thomas Deutschmann (RETIRED) gentoo-dev 2020-03-17 01:12:26 UTC
Closing as obsolete: dev-lang/php-5.x is gone and dev-lang/php-7.x has no mysql extension anymore.
Comment 20 Hans F. Nordhaug 2020-04-02 16:02:19 UTC
I still don't get it: If I select mysqli and pdo, I don't get pdo_mysql without selecting mysql in addition. If the mysql extension is deprecated, why not make mysqli enable mysql? IMHO that would be more user friendly.
Comment 21 Hans F. Nordhaug 2020-04-02 16:22:57 UTC
Sorry about the noise, just trying to make myself clearer:

I think enabling mysqli should require mysql. Currently it is possible to shoot yourself in the foot thinking the mysqli + pdo will enable pdo_mysql.