Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 552156 - app-eselect/eselect-php - add support for PHP 7.0 with apache2
Summary: app-eselect/eselect-php - add support for PHP 7.0 with apache2
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: All Linux
: Normal normal with 3 votes (vote)
Assignee: PHP Bugs
URL:
Whiteboard:
Keywords:
: 567426 (view as bug list)
Depends on:
Blocks: 470986
  Show dependency tree
 
Reported: 2015-06-15 04:26 UTC by Tomáš Mózes
Modified: 2016-01-11 04:18 UTC (History)
6 users (show)

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


Attachments
php.eselect.patch (php.eselect.diff,1.93 KB, patch)
2015-12-03 13:49 UTC, Brian Evans (RETIRED)
Details | Diff
php.eselect.patch (php.eselect.diff,1.94 KB, patch)
2015-12-03 14:03 UTC, Brian Evans (RETIRED)
Details | Diff
php.eselect.canonicalise.patch (php.eselect.canonicalise.diff,2.99 KB, patch)
2015-12-03 14:27 UTC, Brian Evans (RETIRED)
Details | Diff
php.eselect.canonicalise.patch (php.eselect.canonicalise.diff,2.99 KB, patch)
2015-12-03 16:02 UTC, Brian Evans (RETIRED)
Details | Diff
php.eselect.canonicalise.patch (php.eselect.canonicalise.diff,3.06 KB, patch)
2015-12-03 17:21 UTC, Brian Evans (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tomáš Mózes 2015-06-15 04:26:13 UTC
Currently all libphp references under /usr/share/eselect/modules/php.eselect are with hardcoded libphp5 prefix while the new php naturally has libphp7.
Comment 1 Tomáš Mózes 2015-06-15 04:32:04 UTC
It also contains /etc/apache2/modules.d/70_mod_php5.conf that would need to be changed.
Comment 2 Tomáš Mózes 2015-12-03 06:24:47 UTC
Since PHP 7.0.0 is already tagged and in portage, which should try to do something with this ;)
Comment 3 Brian Evans (RETIRED) gentoo-dev 2015-12-03 13:49:00 UTC
Created attachment 418464 [details, diff]
php.eselect.patch

Please test this patch to php.eselect
Comment 4 Michael Orlitzky gentoo-dev 2015-12-03 13:59:50 UTC
Now that we can't avoid updating php.eselect... does the same thing work if we replace `readlink -e` with `canonicalize`? That would fix bug #470986 in the process.

It should be a close substitute for `readlink -e`:

https://wiki.gentoo.org/wiki/Project:Eselect/Developer_guide#Path-manipulation_functions
Comment 5 Brian Evans (RETIRED) gentoo-dev 2015-12-03 14:03:28 UTC
Created attachment 418466 [details, diff]
php.eselect.patch

Please test this patch to php.eselect, try 2.  As for canonicalise, the readlink -e is different than readlink -f (see the man page)
Comment 6 Michael Orlitzky gentoo-dev 2015-12-03 14:14:00 UTC
(In reply to Brian Evans from comment #5)
> Created attachment 418466 [details, diff] [details, diff]
> php.eselect.patch
> 
> Please test this patch to php.eselect, try 2.  As for canonicalise, the
> readlink -e is different than readlink -f (see the man page)

Naturally, if it was *really* easy to fix I would have posted a patch =P

I'm on my way out the door but I can try to figure something out later. Calling `readlink -f` on the nonexistent "/usr/lib64/apache2/modules/libphp7.so" returns the same path (which doesn't exist), so a fix probably amounts to adding a "does the return value exist?" check.
Comment 7 Brian Evans (RETIRED) gentoo-dev 2015-12-03 14:27:38 UTC
Created attachment 418468 [details, diff]
php.eselect.canonicalise.patch

Here is a patch which includes canonicalise
Comment 8 Brian Evans (RETIRED) gentoo-dev 2015-12-03 16:02:29 UTC
Created attachment 418500 [details, diff]
php.eselect.canonicalise.patch

Here is a patch which includes canonicalise (try 2)
Comment 9 Brian Evans (RETIRED) gentoo-dev 2015-12-03 17:21:44 UTC
Created attachment 418502 [details, diff]
php.eselect.canonicalise.patch

Here is a patch which includes canonicalise (try 3) - fix dangling symlink
Comment 10 Tomáš Mózes 2015-12-04 08:48:31 UTC
(In reply to Brian Evans from comment #9)

Huge thanks Brian, tested with 5.6 and 7.0, switching works great! Now only 
/etc/apache2/modules.d/70_mod_php5.conf remains, maybe we can duplicate the code there and add a PHP7 IfDefine section?
Comment 11 Reuben Farrelly 2015-12-04 11:50:17 UTC
Tested and worked well for me too. Thanks Brian..
Comment 12 Frankiz DANIEL 2015-12-05 14:01:20 UTC
This needs to be pushed asap, php 7 is a big deal for a lot of people, and it's real annoying to have it in portage but being unable to use it out of the box because eselect doesn't propose this for apache2.
Comment 13 Michael Orlitzky gentoo-dev 2015-12-06 17:19:46 UTC
*** Bug 567426 has been marked as a duplicate of this bug. ***
Comment 14 Michael Orlitzky gentoo-dev 2015-12-07 01:33:44 UTC
I just pushed a new (masked) version of eselect-php:

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7c711c8293c7f67c8de8e0cab5133d85b77af08d

Please give that a try. I incorporated Brian's patch and made a bunch of other little changes. I moved the development to a public repo:

https://gitweb.gentoo.org/proj/eselect-php.git/

This is still only a partial fix, because the apache config looks for -DPHP5 and the libphp5 module.
Comment 15 Michael Orlitzky gentoo-dev 2015-12-08 19:18:51 UTC
The 5.x and 7.x apache modules can't be used together -- apache will segfault if you try to load them both. This makes me think the "5" and "7" suffices aren't really helpful in the apache config or the module name.

Since you need to choose exactly one, I'm proposing that we just drop the '5' everywhere in the apache config and the module name. The correct module will be symlinked to libphp.so using eselect-php, and then in the new apache config, we'll use -DPHP, "php_module", modules/libphp.so, etc. without reference to the version.

This will require another version bump to eselect-php unfortunately.
Comment 16 Tomáš Mózes 2015-12-09 05:25:58 UTC
(In reply to Michael Orlitzky from comment #15)

Sounds like a good idea :)
Comment 17 Frankiz DANIEL 2015-12-10 14:09:22 UTC
(In reply to Michael Orlitzky from comment #15)
> The 5.x and 7.x apache modules can't be used together -- apache will
> segfault if you try to load them both. This makes me think the "5" and "7"
> suffices aren't really helpful in the apache config or the module name.
> 
> Since you need to choose exactly one, I'm proposing that we just drop the
> '5' everywhere in the apache config and the module name. The correct module
> will be symlinked to libphp.so using eselect-php, and then in the new apache
> config, we'll use -DPHP, "php_module", modules/libphp.so, etc. without
> reference to the version.
> 
> This will require another version bump to eselect-php unfortunately.

There is usually little to no use to have multiple version of php installed anyway. I think people will either want a "stable" version of php or the latest version of php, this should be very binary if the gentoo way can allow this by simply having a keyword switch this should be perfect.
Comment 18 Thomas Stein 2015-12-10 14:13:07 UTC
> There is usually little to no use to have multiple version of php

What? It's the coolest feature ever. Running different versions of php for fpm or apache is what makes gentoo unique. So please touch this feature.
Comment 19 Frankiz DANIEL 2015-12-10 14:21:19 UTC
(In reply to Thomas Stein from comment #18)
> > There is usually little to no use to have multiple version of php
> 
> What? It's the coolest feature ever. Running different versions of php for
> fpm or apache is what makes gentoo unique. So please touch this feature.

I respectfully disagree, i'm not in favor of removing features, ever, as i think this is indeed what makes gentoo special, but in this case i don't see the reason. Especially between a 5 and a 7, the only big big move is a performance boost and for the rest this is backward compatible it could have been named php 5.7 instead of 7.0. Also this might be cool but in what situation exactly is this usefull and not messy? running that script with php 7 and that other script with php 5.6 other than benchmarking purpose? If there is a choice between that feature and being able to run php 7.0 at all the choice is easy to me.
Comment 20 Michael Orlitzky gentoo-dev 2015-12-11 01:16:24 UTC
Don't worry, the support for multiple versions isn't going anywhere. It's useful to a lot of people. I just made another attempt at the apache2 stuff in the recently-pushed eselect-php-0.8.1:

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=983c8fcbdf2b0cea1236c87ac84bf4874a916271

It's masked for testing, and shouldn't go into production yet (obviously?). But if you do PHP work on a dev machine or something, please give it a try. And read the elog, there are configuration changes! If you're not paying attention, apache won't start up again.

Basically, we now use -DPHP instead of -DPHP5, and the apache config was renamed to 70_mod_php.conf from 70_mod_php5.conf. Within that config file, there is an "Include" statement that points to another config managed by eselect. This was the only way I could get the switching to work seamlessly; the two modules (php5_module and php7_module) have different names and there's no way to deal with that inside apache. So eselect now handles it.

Which means... you have to run eselect once before apache will work! But afterwards, you should be able to switch between 5.x and 7.x with an apache restart/reload.
Comment 21 Thomas Stein 2015-12-11 08:33:24 UTC
> Don't worry, the support for multiple versions isn't going anywhere

Uh. I feel better already. :-)

eselect-php-0.8.1 works for me:

sites ~ # eselect php list apache2
  [1]   php7.0 *
sites ~ # 

thanks and cheers
t.
Comment 22 Frankiz DANIEL 2015-12-11 17:28:25 UTC
works for me aswell, now that should probably be unmasked :)
Comment 23 Tomáš Mózes 2015-12-16 07:40:13 UTC
Thanks Michael, tested with PHP 5.5 + 7.0 with apache, works great.
Comment 24 Tomáš Mózes 2015-12-22 12:24:02 UTC
pkg_postinst() of dev-lang/php-7.x needs to be updated:

if use apache2 ; then
  APACHE2_MOD_DEFINE="PHP"
  APACHE2_MOD_CONF="70_mod_php"  # Provided by app-eselect/eselect-php
  apache-module_pkg_postinst
fi
Comment 25 Michael Orlitzky gentoo-dev 2016-01-07 14:58:00 UTC
(In reply to Tomáš Mózes from comment #24)
> pkg_postinst() of dev-lang/php-7.x needs to be updated:
> 
> if use apache2 ; then
>   APACHE2_MOD_DEFINE="PHP"
>   APACHE2_MOD_CONF="70_mod_php"  # Provided by app-eselect/eselect-php
>   apache-module_pkg_postinst
> fi

Thanks for this. I just changed it in-place for php-7.0.1. In the next version of php:5.6, maybe we should require the newer eselect-php; then we could make the same change there.
Comment 26 Michael Orlitzky gentoo-dev 2016-01-09 01:43:50 UTC
I just updated "PHP5" to "PHP" in the most recent version bumps (even though that may wind up being incorrect if they go stable quickly). Best I could do though.

I think that was the last bullet point so I'm gonna say this is fixed.
Comment 27 Tomáš Mózes 2016-01-11 04:18:57 UTC
Thank you all for this, I'm glad we can enjoy PHP7 with Apache on Gentoo :)