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 #47227

Merged
merged 1 commit into from Sep 24, 2018

Conversation

flokli
Copy link
Contributor

@flokli flokli commented Sep 23, 2018

Manual backport of #47220 for 18.03.

As the php expression still uses composableDerivation, we can't easily query what's enabled while defining configureFlags, so simply add the with-mysql-sock on each enabled feature.
PHPs configure phase is happy with that being defined multiple times - not elegant, but I didn't want to resort to bash hackery for that backport :-)


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.

(cherry picked from commit baa04e4)

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.

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.

(cherry picked from commit baa04e4)
@flokli
Copy link
Contributor Author

flokli commented Sep 23, 2018

@GrahamcOfBorg test wordpress

@GrahamcOfBorg
Copy link

Failure on x86_64-darwin (full log)

Attempted: php

Partial log (click to expand)

copying path '/nix/store/galwrkwxx6xqdd5n6alh3fsm3pvswn5z-clang-wrapper-5.0.2' from 'https://cache.nixos.org'...
copying path '/nix/store/70apd71n6ng1ws4mbx6ciiqjc30vcwdq-stdenv-darwin' from 'https://cache.nixos.org'...
building '/nix/store/dxh67a8l063mvhmn9cfjqpmj48rq3n6z-php-7.2.8.drv'...
/nix/store/8zbc9ycngkmz95a0qqcmqf58qq5c680q-cctools-binutils-darwin-wrapper/nix-support/setup-hook: fork: retry: Resource temporarily unavailable
/nix/store/8zbc9ycngkmz95a0qqcmqf58qq5c680q-cctools-binutils-darwin-wrapper/nix-support/setup-hook: fork: retry: Resource temporarily unavailable
/nix/store/8zbc9ycngkmz95a0qqcmqf58qq5c680q-cctools-binutils-darwin-wrapper/nix-support/setup-hook: fork: retry: Resource temporarily unavailable
/nix/store/8zbc9ycngkmz95a0qqcmqf58qq5c680q-cctools-binutils-darwin-wrapper/nix-support/setup-hook: fork: retry: Resource temporarily unavailable
/nix/store/8zbc9ycngkmz95a0qqcmqf58qq5c680q-cctools-binutils-darwin-wrapper/nix-support/setup-hook: fork: Resource temporarily unavailable
builder for '/nix/store/dxh67a8l063mvhmn9cfjqpmj48rq3n6z-php-7.2.8.drv' failed with exit code 254
error: build of '/nix/store/dxh67a8l063mvhmn9cfjqpmj48rq3n6z-php-7.2.8.drv' failed

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: php

Partial log (click to expand)

/nix/store/lqc4lp6ivh7pp9dk5pjfj4maxzkpi3as-php-7.2.8/lib/build/config.guess: interpreter directive changed from " /bin/sh" to "/nix/store/lw7xaqhakk0i1c631m3cvac3x4lc5gr5-bash-4.4-p12/bin/sh"
/nix/store/lqc4lp6ivh7pp9dk5pjfj4maxzkpi3as-php-7.2.8/lib/build/shtool: interpreter directive changed from "/bin/sh" to "/nix/store/lw7xaqhakk0i1c631m3cvac3x4lc5gr5-bash-4.4-p12/bin/sh"
/nix/store/lqc4lp6ivh7pp9dk5pjfj4maxzkpi3as-php-7.2.8/lib/build/config.sub: interpreter directive changed from " /bin/sh" to "/nix/store/lw7xaqhakk0i1c631m3cvac3x4lc5gr5-bash-4.4-p12/bin/sh"
checking for references to /build in /nix/store/lqc4lp6ivh7pp9dk5pjfj4maxzkpi3as-php-7.2.8...
moving /nix/store/lqc4lp6ivh7pp9dk5pjfj4maxzkpi3as-php-7.2.8/sbin/* to /nix/store/lqc4lp6ivh7pp9dk5pjfj4maxzkpi3as-php-7.2.8/bin
shrinking RPATHs of ELF executables and libraries in /nix/store/ilm8nz0hwydyv9p93abkcz9rrgnn8hh8-php-7.2.8-dev
strip is /nix/store/k8b9hqv58dd1z0j4ikak24ykndcm91s6-binutils-2.28.1/bin/strip
patching script interpreter paths in /nix/store/ilm8nz0hwydyv9p93abkcz9rrgnn8hh8-php-7.2.8-dev
checking for references to /build in /nix/store/ilm8nz0hwydyv9p93abkcz9rrgnn8hh8-php-7.2.8-dev...
/nix/store/lqc4lp6ivh7pp9dk5pjfj4maxzkpi3as-php-7.2.8

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: php

Partial log (click to expand)

these derivations will be built:
  /nix/store/z7an7bcnp8zbhq630n56kymsbhllq475-php-7.2.8.drv
waiting for locks or build slots...
/nix/store/w2jymw96fpjsjhqxdd31b8mfa28j0kwc-php-7.2.8

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: tests.wordpress

Partial log (click to expand)

web: exit status 1
syncing
web: running command: sync
web: exit status 0
test script finished in 29.61s
cleaning up
killing web (pid 627)
vde_switch: EOF on stdin, cleaning up and exiting
vde_switch: Could not remove ctl dir '/build/vde1.ctl': Directory not empty
/nix/store/8l4v3qsw19najch1g3k4rxpv3r44vzdq-vm-test-run-wordpress

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: tests.wordpress

Partial log (click to expand)

web: exit status 1
syncing
web: running command: sync
web: exit status 0
test script finished in 26.04s
cleaning up
killing web (pid 593)
vde_switch: EOF on stdin, cleaning up and exiting
vde_switch: Could not remove ctl dir '/build/vde1.ctl': Directory not empty
/nix/store/nn4x0c23hd3wp53l93gc8hhdwdqiakcr-vm-test-run-wordpress

@Mic92 Mic92 merged commit 8e41b9f into NixOS:release-18.03 Sep 24, 2018
@flokli flokli deleted the php-mysql-sock-18.03 branch September 24, 2018 09:06
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