deb.sury.org icon indicating copy to clipboard operation
deb.sury.org copied to clipboard

the alternatives for php-config, phpize and phpdbg should match the php one automatically

Open stof opened this issue 8 years ago • 10 comments

update-alternatives has a way to create secondary alternatives following the main one (used for instance for the man page). Currently, the alternatives for php-config, phpize and phpdbg are totally independent from the php alternative. So on my machine where I switched the php alternative to be php5.6 (temporarily), phpize is still pointing to phpize7.0. This leads to an inconsistent PHP setup. Would it make sense to have php-config, phpize and phpdbg be configured automatically based on the php alternative ?

stof avatar May 13 '16 10:05 stof

It would make a sense, but since it's not supported by upstream, it would require patching, and it's an edge case, I am not putting this high on my priority list. Patches to implement this are welcome though.

oerdnj avatar May 13 '16 10:05 oerdnj

@stof JFTR I believe you cannot use update-alternatives cross-package, so this would need patching phpize, php-config and others, to always pick the versioned variant of the command they are going to use.

oerdnj avatar May 13 '16 11:05 oerdnj

well, then it may not be worth it. It is quite an edge case. Documenting the edge case may be enough.

stof avatar May 13 '16 12:05 stof

@stof Willing to write a bit about it here? https://github.com/oerdnj/deb.sury.org/wiki (everybody should have a write permission). I'll review that happily

oerdnj avatar May 13 '16 12:05 oerdnj

I was also wondering which php version will be used in /usr/bin/php ?

Also the upgrade path from stock repository packages is not really documented. When I was upgrading my system, I was still having the legacy repo in place, which screwed some stuff: I had a mixed 5.6/7.0 setup afterwards.

Also libapache2-mod-php was installed without beeing asked for. The service php5.6-fpm was created, but the already running php5-fpm was not uninstalled nor deactivated.

How can I get consistent setup again? @oerdnj Can I use update-alternatives for this task somehow?

I am running Ubuntu Trusty

mablae avatar May 16 '16 12:05 mablae

@mablae The highest installed version (the priority is computed as , e.g. 56 for PHP 5.6 and 70 for PHP 7.0).

oerdnj avatar May 16 '16 14:05 oerdnj

@mablae You have asked for documentation about PPA migration, it's a start and everybody is welcome to add more content there.

oerdnj avatar May 17 '16 15:05 oerdnj

change php version

sudo update-alternatives --config php
sudo update-alternatives --config php-config
sudo update-alternatives --config phpize

i do this for composer. :heart_eyes:

tigefa4u avatar May 31 '16 13:05 tigefa4u

@tigefa4u This is what was needed after migration from the legacy repo to new one! Thanks!

mablae avatar May 31 '16 14:05 mablae

BTW If you run:

phpizeX.Y
./configure --with-php-config=php-configX.Y

It should pick the right PHP CLI binary.

Other than that it would require she'll wrapper for each command to pick the global PHP version.

I was also thinking about creating custom update-php-version command, but that wouldn't really work because you cannot switch the commands not yet installed. And it would be very hard to detect whether the user has switched something by hand.

So, I would adhere to KISS principle here and just leave it as it is.

oerdnj avatar Jun 09 '16 05:06 oerdnj