Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

php: set mysql socket path if mysql[i] or pdo_mysql support is enabled #47220

Merged
merged 1 commit into from Sep 23, 2018

Conversation

flokli
Copy link
Contributor

@flokli flokli commented Sep 23, 2018

PHP tries to discover the mysql default socket path during configure
phase by probing the file system:
https://github.com/php/php-src/blob/cf3b852109a88a11370d0207cd3b72a53b6a64c3/ext/mysqli/config.m4#L4

This obviously fails to discover /run/mysqld/mysqld.sock, which is being
used (hardcoded) across all MySQL flavours.

This leads to PHP having no mysql socket path set for the mysql[i]
extensions, and /tmp/mysql.sock set for pdo_mysql,
meaning one currently has to manually configure and set it in php.ini.

Luckily, PHP supports setting that path via
--with-mysql-sock=/run/mysqld/mysqld.sock during configure phase,
so let's do this as soon as one of the three modules is enabled.

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

This should probably be backported to 18.03 and 18.09 too.

PHP tries to discover the mysql default socket path during configure
phase by probing the file system:
https://github.com/php/php-src/blob/cf3b852109a88a11370d0207cd3b72a53b6a64c3/ext/mysqli/config.m4#L4

This obviously fails to discover /run/mysqld/mysqld.sock, which is being
used (hardcoded) across all MySQL flavours.

This leads to PHP having no mysql socket path set for the mysql[i]
extensions, and `/tmp/mysql.sock` set for pdo_mysql,
meaning one currently has to manually configure and set it in php.ini.

Luckily, PHP supports setting that path via
`--with-mysql-sock=/run/mysqld/mysqld.sock` during configure phase,
so let's do this as soon as one of the three modules is enabled.
@flokli
Copy link
Contributor Author

flokli commented Sep 23, 2018

symptoms: #44994 (comment)

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: php

Partial log (click to expand)

/nix/store/y59cgqayvdhxy38ip46d6694jz7ags4l-php-7.2.10/lib/build/config.guess: interpreter directive changed from " /bin/sh" to "/nix/store/czx8vkrb9jdgjyz8qfksh10vrnqa723l-bash-4.4-p23/bin/sh"
/nix/store/y59cgqayvdhxy38ip46d6694jz7ags4l-php-7.2.10/lib/build/shtool: interpreter directive changed from "/bin/sh" to "/nix/store/czx8vkrb9jdgjyz8qfksh10vrnqa723l-bash-4.4-p23/bin/sh"
/nix/store/y59cgqayvdhxy38ip46d6694jz7ags4l-php-7.2.10/lib/build/config.sub: interpreter directive changed from " /bin/sh" to "/nix/store/czx8vkrb9jdgjyz8qfksh10vrnqa723l-bash-4.4-p23/bin/sh"
checking for references to /build in /nix/store/y59cgqayvdhxy38ip46d6694jz7ags4l-php-7.2.10...
moving /nix/store/y59cgqayvdhxy38ip46d6694jz7ags4l-php-7.2.10/sbin/* to /nix/store/y59cgqayvdhxy38ip46d6694jz7ags4l-php-7.2.10/bin
shrinking RPATHs of ELF executables and libraries in /nix/store/91i5865jk1v26k4awp6arsnpbmrxndsp-php-7.2.10-dev
strip is /nix/store/h0lbngpv6ln56hjj59i6l77vxq25flbz-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/91i5865jk1v26k4awp6arsnpbmrxndsp-php-7.2.10-dev
checking for references to /build in /nix/store/91i5865jk1v26k4awp6arsnpbmrxndsp-php-7.2.10-dev...
/nix/store/y59cgqayvdhxy38ip46d6694jz7ags4l-php-7.2.10

@flokli flokli mentioned this pull request Sep 23, 2018
9 tasks
@GrahamcOfBorg
Copy link

Success on x86_64-darwin (full log)

Attempted: php

Partial log (click to expand)

/nix/store/mjdnccg698i42hxv792ibix2nccx1q0m-php-7.2.8/bin/peardev: interpreter directive changed from "/bin/sh" to "/nix/store/z2pc6bbx9d1mwwahnds31a7nlvjbi9zr-bash-4.4-p23/bin/sh"
/nix/store/mjdnccg698i42hxv792ibix2nccx1q0m-php-7.2.8/bin/pecl: interpreter directive changed from "/bin/sh" to "/nix/store/z2pc6bbx9d1mwwahnds31a7nlvjbi9zr-bash-4.4-p23/bin/sh"
/nix/store/mjdnccg698i42hxv792ibix2nccx1q0m-php-7.2.8/bin/php-config: interpreter directive changed from " /bin/sh" to "/nix/store/z2pc6bbx9d1mwwahnds31a7nlvjbi9zr-bash-4.4-p23/bin/sh"
/nix/store/mjdnccg698i42hxv792ibix2nccx1q0m-php-7.2.8/lib/build/shtool: interpreter directive changed from "/bin/sh" to "/nix/store/z2pc6bbx9d1mwwahnds31a7nlvjbi9zr-bash-4.4-p23/bin/sh"
/nix/store/mjdnccg698i42hxv792ibix2nccx1q0m-php-7.2.8/lib/build/config.guess: interpreter directive changed from " /bin/sh" to "/nix/store/z2pc6bbx9d1mwwahnds31a7nlvjbi9zr-bash-4.4-p23/bin/sh"
/nix/store/mjdnccg698i42hxv792ibix2nccx1q0m-php-7.2.8/lib/build/config.sub: interpreter directive changed from " /bin/sh" to "/nix/store/z2pc6bbx9d1mwwahnds31a7nlvjbi9zr-bash-4.4-p23/bin/sh"
moving /nix/store/mjdnccg698i42hxv792ibix2nccx1q0m-php-7.2.8/sbin/* to /nix/store/mjdnccg698i42hxv792ibix2nccx1q0m-php-7.2.8/bin
strip is /nix/store/4w56qihlrddav67p7d1vy5qkyayaqw11-cctools-binutils-darwin/bin/strip
patching script interpreter paths in /nix/store/75hgyjpskygn2ch87z5qvnvnvqln9ws3-php-7.2.8-dev
/nix/store/mjdnccg698i42hxv792ibix2nccx1q0m-php-7.2.8

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: php

Partial log (click to expand)

/nix/store/4lk83gdydp2mwgs05467d21yr625z42p-php-7.2.10/bin/pear: interpreter directive changed from "/bin/sh" to "/nix/store/fqm2x6kiay1q4vg7pqp4wp17bdijlyc3-bash-4.4-p23/bin/sh"
/nix/store/4lk83gdydp2mwgs05467d21yr625z42p-php-7.2.10/bin/php-config: interpreter directive changed from " /bin/sh" to "/nix/store/fqm2x6kiay1q4vg7pqp4wp17bdijlyc3-bash-4.4-p23/bin/sh"
/nix/store/4lk83gdydp2mwgs05467d21yr625z42p-php-7.2.10/bin/phpize: interpreter directive changed from "/bin/sh" to "/nix/store/fqm2x6kiay1q4vg7pqp4wp17bdijlyc3-bash-4.4-p23/bin/sh"
checking for references to /build in /nix/store/4lk83gdydp2mwgs05467d21yr625z42p-php-7.2.10...
moving /nix/store/4lk83gdydp2mwgs05467d21yr625z42p-php-7.2.10/sbin/* to /nix/store/4lk83gdydp2mwgs05467d21yr625z42p-php-7.2.10/bin
shrinking RPATHs of ELF executables and libraries in /nix/store/wcmw5llxjza4zs6gyab366gfk8m4vg76-php-7.2.10-dev
strip is /nix/store/y4ymnvgxygpq05h03kyzbj572zmh6zla-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/wcmw5llxjza4zs6gyab366gfk8m4vg76-php-7.2.10-dev
checking for references to /build in /nix/store/wcmw5llxjza4zs6gyab366gfk8m4vg76-php-7.2.10-dev...
/nix/store/4lk83gdydp2mwgs05467d21yr625z42p-php-7.2.10

@Mic92 Mic92 merged commit a326da9 into NixOS:master Sep 23, 2018
@Mic92
Copy link
Member

Mic92 commented Sep 23, 2018

backport: 5bb85cd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants