Skip to content

mysqlnd: detect mysql unix socket path with mysql_config - #361

Closed
blino wants to merge 1 commit into
php:masterfrom
blino:master
Closed

blino wants to merge 1 commit into
php:masterfrom
blino:master

Conversation

@blino

@blino blino commented Jun 23, 2013

Copy link
Copy Markdown

When the mysql extension is disabled, there is no automatic detection
of the mysql unix socket path.
The mysqli/mysqlnd/pdo_mysql use a hardcoded /tmp/mysql.sock path.

This adds automatic detection of the mysql unix socket path in mysqlnd
with mysql_config --socket, and makes pdo_mysql use it as well.

When the mysql extension is disabled, there is no automatic detection
of the mysql unix socket path.
The mysqli/mysqlnd/pdo_mysql use a hardcoded /tmp/mysql.sock path.

This adds automatic detection of the mysql unix socket path in mysqlnd
with mysql_config --socket, and makes pdo_mysql use it as well.
@smalyshev

Copy link
Copy Markdown
Contributor

We have option --with-mysql-sock but it seems to be ignored with this patch. Also I'm not sure how is it going to work with --with-mysqli=mysqlnd

@blino

blino commented Jun 24, 2013

Copy link
Copy Markdown
Author

The --with-mysql-sock option will have no effect if the mysql extension is disabled (see the matching config.m4)

@smalyshev

Copy link
Copy Markdown
Contributor

My point is it'd be great if it did have effect, since we already have option for specifying mysql file and some people probably use it.

@blino

blino commented Jun 24, 2013

Copy link
Copy Markdown
Author

I think it is less error-prone for distributions to use mysql_config --socket for that.
Here is how we enable mysqli in php in the Mageia package with my patch:
--with-mysqli=shared,mysqlnd --enable-mysqlnd=shared,/usr/bin/mysql_config

If you prefer the --with-mysql-sock approach, we should move it to some common mysql config.m4 file.
Maybe the mysqlnd one would be the best place since it is the most central mysql extension?

@smalyshev

Copy link
Copy Markdown
Contributor

@blino moving it to mysqlnd may be an option

@johannes

Copy link
Copy Markdown
Member

mysqlnd should be fully independent from libmysql and mysql_config.With this option it might be misleading. I could rather accept an --with-mysqlnd-default-sock=PATH, this could be used like this: --with-mysqlnd-default-sock=mysqlnd-config --sock
Another issue is that we try to limit the number of places where this could be set. We have user code, ini settings and a fixed default right now. Each additional place makes debugging issues harder (I've seen a few issues with users using bad abstractions which where hiding raw errors and who were confused)
I'm closing this PR as we won't add it in this form, but I'm open for further discussion on the form mentioned above.

@johannes johannes closed this Jul 23, 2013
@johannes

Copy link
Copy Markdown
Member

Andrey just made me aware of the fact that --with-mysql-sock is documented like this: MySQL/MySQLi/PDO_MYSQL: Location of the MySQL unix socket pointer. So the fact that this depends on ext/mysql being active is a bug. Not sure where to move that, considering that we'll remove ext/mysql at some point, maybe "deprecate" the option and use a mysqlnd version? But that's wrong, too as it works on libmysql builds, too.

@johannes johannes reopened this Jul 23, 2013
@johannes

Copy link
Copy Markdown
Member

One place for the generic search function from ext/mysql/config.m4 might be aclocal.m4 similar to PHP_SETUP_LIBXML

@php-pulls

Copy link
Copy Markdown

Comment on behalf of krakjoe at php.net:

Since the landscape of PHP is now different (mysql having been removed), and since this PR has merge conflicts, and since the author seems to have abandoned the work, I'm closing this PR.

In addition the socket path is and always has been configurable.

If anyone feels that this still needs to be merged, please open a clean PR, with tests, and ensure those tests pass.

@php-pulls php-pulls closed this Jan 1, 2017
kasparsd added a commit to kasparsd/php-7-debian that referenced this pull request Aug 4, 2018
—with-mysql-sock is ignored now that the legacy mysql has been removed, see php/php-src#361
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants