1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 inherit flag-o-matic eapi7-ver systemd
8 DESCRIPTION="The PHP language runtime engine"
9 HOMEPAGE="https://secure.php.net/"
10 SRC_URI="https://secure.php.net/distributions/${P}.tar.xz"
18 unicode? ( BSD-2 LGPL-2.1 )"
21 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
23 # We can build the following SAPIs in the given order
24 SAPIS="embed cli cgi fpm apache2 phpdbg"
26 # SAPIs and SAPI-specific USE flags (cli SAPI is default on):
31 IUSE="${IUSE} acl bcmath berkdb bzip2 calendar cdb cjk
32 coverage crypt +ctype curl debug
33 enchant exif +fileinfo +filter firebird
34 flatfile ftp gd gdbm gmp +hash +iconv imap inifile
35 intl iodbc ipv6 +json kerberos ldap ldap-sasl libedit libressl
36 mhash mssql mysql mysqli nls
37 oci8-instant-client odbc +opcache pcntl pdo +phar +posix postgres qdbm
38 readline recode selinux +session sharedmem
39 +simplexml snmp soap sockets spell sqlite ssl
40 sysvipc systemd tidy +tokenizer truetype unicode wddx webp
41 +xml xmlreader xmlwriter xmlrpc xpm xslt zip zlib"
43 # The supported (that is, autodetected) versions of BDB are listed in
44 # the ./configure script. Other versions *work*, but we need to stick to
45 # the ones that can be detected to avoid a repeat of bug #564824.
47 >=app-eselect/eselect-php-0.9.1[apache2?,fpm?]
48 >=dev-libs/libpcre-8.32[unicode]
49 fpm? ( acl? ( sys-apps/acl ) )
50 apache2? ( || ( >=www-servers/apache-2.4[apache2_modules_unixd,threads=]
51 <www-servers/apache-2.4[threads=] ) )
52 berkdb? ( || ( sys-libs/db:5.3
58 bzip2? ( app-arch/bzip2:0= )
59 cdb? ( || ( dev-db/cdb dev-db/tinycdb ) )
65 coverage? ( dev-util/lcov )
66 crypt? ( >=dev-libs/libmcrypt-2.4 )
67 curl? ( >=net-misc/curl-7.10.5 )
68 enchant? ( app-text/enchant )
74 firebird? ( dev-db/firebird )
75 gd? ( virtual/jpeg:0 media-libs/libpng:0= sys-libs/zlib:0= )
76 gdbm? ( >=sys-libs/gdbm-1.8.0:0= )
77 gmp? ( dev-libs/gmp:0= )
78 iconv? ( virtual/libiconv )
79 imap? ( virtual/imap-c-client[kerberos=,ssl=] )
80 intl? ( <dev-libs/icu-61.1:= )
81 iodbc? ( dev-db/libiodbc )
82 kerberos? ( virtual/krb5 )
83 ldap? ( >=net-nds/openldap-1.2.11 )
84 ldap-sasl? ( dev-libs/cyrus-sasl >=net-nds/openldap-1.2.11 )
85 libedit? ( || ( sys-freebsd/freebsd-lib dev-libs/libedit ) )
86 mssql? ( dev-db/freetds[mssql] )
87 nls? ( sys-devel/gettext )
88 oci8-instant-client? ( dev-db/oracle-instantclient-basic )
89 odbc? ( >=dev-db/unixODBC-1.8.13 )
90 postgres? ( dev-db/postgresql:* )
92 readline? ( sys-libs/readline:0= )
93 recode? ( app-text/recode )
94 sharedmem? ( dev-libs/mm )
95 simplexml? ( >=dev-libs/libxml2-2.6.8 )
96 snmp? ( >=net-analyzer/net-snmp-5.2 )
97 soap? ( >=dev-libs/libxml2-2.6.8 )
98 spell? ( >=app-text/aspell-0.50 )
99 sqlite? ( >=dev-db/sqlite-3.7.6.3 )
101 !libressl? ( dev-libs/openssl:0= )
102 libressl? ( dev-libs/libressl:0= )
104 tidy? ( app-text/htmltidy )
106 =media-libs/freetype-2*
108 virtual/jpeg:0 media-libs/libpng:0= sys-libs/zlib:0= )
110 unicode? ( dev-libs/oniguruma:= )
111 wddx? ( >=dev-libs/libxml2-2.6.8 )
112 webp? ( media-libs/libwebp:0= )
113 xml? ( >=dev-libs/libxml2-2.6.8 )
114 xmlrpc? ( >=dev-libs/libxml2-2.6.8 virtual/libiconv )
115 xmlreader? ( >=dev-libs/libxml2-2.6.8 )
116 xmlwriter? ( >=dev-libs/libxml2-2.6.8 )
120 media-libs/libpng:0= sys-libs/zlib:0=
122 xslt? ( dev-libs/libxslt >=dev-libs/libxml2-2.6.8 )
123 zip? ( sys-libs/zlib:0= )
124 zlib? ( sys-libs/zlib:0= )
127 RDEPEND="${COMMON_DEPEND}
130 selinux? ( sec-policy/selinux-phpfpm )
131 systemd? ( sys-apps/systemd ) )"
133 DEPEND="${COMMON_DEPEND}
135 >=sys-devel/bison-3.0.1
138 >=sys-devel/libtool-1.5.18"
140 # Without USE=readline or libedit, the interactive "php -a" CLI will hang.
142 || ( cli cgi fpm apache2 embed phpdbg )
143 cli? ( ^^ ( readline libedit ) )
144 truetype? ( gd zlib )
153 xmlrpc? ( || ( xml iconv ) )
160 readline? ( !libedit )
161 recode? ( !imap !mysqli !mysql )
162 sharedmem? ( !threads )
163 mysql? ( || ( mysqli pdo ) )
167 "${FILESDIR}/mbstring-oniguruma-6.8.patch"
168 # hopefully upstream will include the same version check fixes in upcoming releases
169 # patch added 20180429
170 "${FILESDIR}/libressl-compatibility.patch"
171 "${FILESDIR}/php-freetype-2.9.1.patch"
174 PHP_MV="$(ver_cut 1)"
179 # work out where we are installing the ini file
180 php_set_ini_dir "${phpsapi}"
182 # Always install the production INI file, bug 611214.
183 local phpinisrc="php.ini-production-${phpsapi}"
184 cp php.ini-production "${phpinisrc}" || die
186 # default to /tmp for save_path, bug #282768
187 sed -e 's|^;session.save_path .*$|session.save_path = "'"${EPREFIX}"'/tmp"|g' -i "${phpinisrc}" || die
189 # Set the extension dir
190 sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" \
191 -i "${phpinisrc}" || die
193 # Set the include path to point to where we want to find PEAR packages
194 sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:'"${EPREFIX}"'/usr/share/php'${PHP_MV}':'"${EPREFIX}"'/usr/share/php"|' -i "${phpinisrc}" || die
196 dodir "${PHP_INI_DIR#${EPREFIX}}"
197 insinto "${PHP_INI_DIR#${EPREFIX}}"
198 newins "${phpinisrc}" php.ini
200 elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR#${EPREFIX}}"
203 dodir "${PHP_EXT_INI_DIR#${EPREFIX}}"
204 dodir "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}"
207 elog "Adding opcache to $PHP_EXT_INI_DIR"
208 echo "zend_extension=${PHP_DESTDIR}/$(get_libdir)/opcache.so" >> \
209 "${D}/${PHP_EXT_INI_DIR}"/opcache.ini
210 dosym "${PHP_EXT_INI_DIR#${EPREFIX}}/opcache.ini" \
211 "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}/opcache.ini"
214 # SAPI-specific handling
215 if [[ "${sapi}" == "fpm" ]] ; then
216 einfo "Installing FPM config files php-fpm.conf and www.conf"
217 insinto "${PHP_INI_DIR#${EPREFIX}}"
218 doins sapi/fpm/php-fpm.conf
219 insinto "${PHP_INI_DIR#${EPREFIX}}/fpm.d"
220 doins sapi/fpm/www.conf
223 dodoc php.ini-{development,production}
227 PHP_INI_DIR="${EPREFIX}/etc/php/${1}-php${SLOT}"
228 PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
229 PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
235 # In php-7.x, the FPM pool configuration files have been split off
236 # of the main config. By default the pool config files go in
237 # e.g. /etc/php-fpm.d, which isn't slotted. So here we move the
238 # include directory to a subdirectory "fpm.d" of $PHP_INI_DIR. Later
239 # we'll install the pool configuration file "www.conf" there.
241 sed -i "s~^include=.*$~include=${PHP_INI_DIR}/fpm.d/*.conf~" \
242 sapi/fpm/php-fpm.conf.in \
243 || die 'failed to move the include directory in php-fpm.conf'
247 addpredict /usr/share/snmp/mibs/.index #nowarn
248 addpredict /var/lib/net-snmp/mib_indexes #nowarn
250 PHP_DESTDIR="${EPREFIX}/usr/$(get_libdir)/php${SLOT}"
252 # The php-fpm config file wants localstatedir to be ${EPREFIX}/var
253 # and not the Gentoo default ${EPREFIX}/var/lib. See bug 572002.
255 --prefix="${PHP_DESTDIR}"
256 --mandir="${PHP_DESTDIR}/man"
257 --infodir="${PHP_DESTDIR}/info"
258 --libdir="${PHP_DESTDIR}/lib"
259 --with-libdir="$(get_libdir)"
260 --localstatedir="${EPREFIX}/var"
262 $(use_enable threads maintainer-zts)
266 $(use_enable bcmath bcmath)
267 $(use_with bzip2 bz2 "${EPREFIX}/usr")
268 $(use_enable calendar calendar)
269 $(use_enable coverage gcov)
270 $(use_enable ctype ctype)
271 $(use_with curl curl "${EPREFIX}/usr")
272 $(use_enable xml dom)
273 $(use_with enchant enchant "${EPREFIX}/usr")
274 $(use_enable exif exif)
275 $(use_enable fileinfo fileinfo)
276 $(use_enable filter filter)
277 $(use_enable ftp ftp)
278 $(use_with nls gettext "${EPREFIX}/usr")
279 $(use_with gmp gmp "${EPREFIX}/usr")
280 $(use_enable hash hash)
281 $(use_with mhash mhash "${EPREFIX}/usr")
282 $(use_with iconv iconv \
283 $(use elibc_glibc || use elibc_musl || use elibc_FreeBSD || echo "${EPREFIX}/usr"))
284 $(use_enable intl intl)
285 $(use_enable ipv6 ipv6)
286 $(use_enable json json)
287 $(use_with kerberos kerberos "${EPREFIX}/usr")
288 $(use_enable xml libxml)
289 $(use_with xml libxml-dir "${EPREFIX}/usr")
290 $(use_enable unicode mbstring)
291 $(use_with crypt mcrypt "${EPREFIX}/usr")
292 $(use_with unicode onig "${EPREFIX}/usr")
293 $(use_with ssl openssl "${EPREFIX}/usr")
294 $(use_with ssl openssl-dir "${EPREFIX}/usr")
295 $(use_enable pcntl pcntl)
296 $(use_enable phar phar)
297 $(use_enable pdo pdo)
298 $(use_enable opcache opcache)
299 $(use_with postgres pgsql "${EPREFIX}/usr")
300 $(use_enable posix posix)
301 $(use_with spell pspell "${EPREFIX}/usr")
302 $(use_with recode recode "${EPREFIX}/usr")
303 $(use_enable simplexml simplexml)
304 $(use_enable sharedmem shmop)
305 $(use_with snmp snmp "${EPREFIX}/usr")
306 $(use_enable soap soap)
307 $(use_enable sockets sockets)
308 $(use_with sqlite sqlite3 "${EPREFIX}/usr")
309 $(use_enable sysvipc sysvmsg)
310 $(use_enable sysvipc sysvsem)
311 $(use_enable sysvipc sysvshm)
312 $(use_with tidy tidy "${EPREFIX}/usr")
313 $(use_enable tokenizer tokenizer)
314 $(use_enable wddx wddx)
315 $(use_enable xml xml)
316 $(use_enable xmlreader xmlreader)
317 $(use_enable xmlwriter xmlwriter)
318 $(use_with xmlrpc xmlrpc)
319 $(use_with xslt xsl "${EPREFIX}/usr")
320 $(use_enable zip zip)
321 $(use_with zlib zlib "${EPREFIX}/usr")
322 $(use_enable debug debug)
326 if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
328 our_conf+=( "--enable-dba${shared}" )
331 # DBA drivers support
334 $(use_with berkdb db4 "${EPREFIX}/usr")
335 $(use_enable flatfile flatfile)
336 $(use_with gdbm gdbm "${EPREFIX}/usr")
337 $(use_enable inifile inifile)
338 $(use_with qdbm qdbm "${EPREFIX}/usr")
341 # Support for the GD graphics library
343 $(use_with truetype freetype-dir "${EPREFIX}/usr")
344 $(use_enable cjk gd-jis-conv)
345 $(use_with gd jpeg-dir "${EPREFIX}/usr")
346 $(use_with gd png-dir "${EPREFIX}/usr")
347 $(use_with xpm xpm-dir "${EPREFIX}/usr")
350 our_conf+=( --with-webp-dir="${EPREFIX}/usr" )
352 # enable gd last, so configure can pick up the previous settings
353 our_conf+=( $(use_with gd gd) )
358 $(use_with imap imap "${EPREFIX}/usr")
359 $(use_with ssl imap-ssl "${EPREFIX}/usr")
363 # Interbase/firebird support
364 our_conf+=( $(use_with firebird interbase "${EPREFIX}/usr") )
369 $(use_with ldap ldap "${EPREFIX}/usr")
370 $(use_with ldap-sasl ldap-sasl "${EPREFIX}/usr")
375 local mysqllib="mysqlnd"
376 local mysqlilib="mysqlnd"
378 our_conf+=( $(use_with mysqli mysqli "${mysqlilib}") )
380 local mysqlsock="${EPREFIX}/var/run/mysqld/mysqld.sock"
381 if use mysql || use mysqli ; then
382 our_conf+=( $(use_with mysql mysql-sock "${mysqlsock}") )
387 $(use_with odbc unixODBC "${EPREFIX}/usr")
388 $(use_with iodbc iodbc "${EPREFIX}/usr")
392 our_conf+=( $(use_with oci8-instant-client oci8) )
397 $(use_with mssql pdo-dblib "${EPREFIX}/usr")
398 $(use_with mysql pdo-mysql "${mysqllib}")
399 $(use_with postgres pdo-pgsql)
400 $(use_with sqlite pdo-sqlite "${EPREFIX}/usr")
401 $(use_with firebird pdo-firebird "${EPREFIX}/usr")
402 $(use_with odbc pdo-odbc "unixODBC,${EPREFIX}/usr")
403 $(use_with oci8-instant-client pdo-oci)
407 # readline/libedit support
409 $(use_with readline readline "${EPREFIX}/usr")
410 $(use_with libedit libedit "${EPREFIX}/usr")
414 if use session ; then
415 our_conf+=( $(use_with sharedmem mm "${EPREFIX}/usr") )
417 our_conf+=( $(use_enable session session) )
420 # Use pic for shared modules such as apache2's mod_php
421 our_conf+=( --with-pic )
423 # we use the system copy of pcre
424 # --with-pcre-regex affects ext/pcre
425 # --with-pcre-dir affects ext/filter and ext/zip
427 --with-pcre-regex="${EPREFIX}/usr"
428 --with-pcre-dir="${EPREFIX}/usr"
431 # Catch CFLAGS problems
433 # Changed order to run it in reverse for bug #32022 and #12021.
434 replace-cpu-flags "k6*" "i586"
436 # Cache the ./configure test results between SAPIs.
437 our_conf+=( --cache-file="${T}/config.cache" )
439 # Support user-passed configuration parameters
440 our_conf+=( ${EXTRA_ECONF:-} )
442 # Support the Apache2 extras, they must be set globally for all
443 # SAPIs to work correctly, especially for external PHP extensions
445 mkdir -p "${WORKDIR}/sapis-build" || die
446 for one_sapi in $SAPIS ; do
447 use "${one_sapi}" || continue
448 php_set_ini_dir "${one_sapi}"
450 # The BUILD_DIR variable is used to determine where to output
451 # the files that autotools creates. This was all originally
452 # based on the autotools-utils eclass.
453 BUILD_DIR="${WORKDIR}/sapis-build/${one_sapi}"
454 cp -a "${S}" "${BUILD_DIR}" || die
455 cd "${BUILD_DIR}" || die
458 --with-config-file-path="${PHP_INI_DIR}"
459 --with-config-file-scan-dir="${PHP_EXT_INI_DIR_ACTIVE}"
462 for sapi in $SAPIS ; do
464 cli|cgi|embed|fpm|phpdbg)
465 if [[ "${one_sapi}" == "${sapi}" ]] ; then
466 sapi_conf+=( "--enable-${sapi}" )
467 if [[ "fpm" == "${sapi}" ]] ; then
469 $(use_with acl fpm-acl)
470 $(use_with systemd fpm-systemd)
474 sapi_conf+=( "--disable-${sapi}" )
479 if [[ "${one_sapi}" == "${sapi}" ]] ; then
480 sapi_conf+=( --with-apxs2="${EPREFIX}/usr/bin/apxs" )
482 sapi_conf+=( --without-apxs2 )
488 # Construct the $myeconfargs array by concatenating $our_conf
489 # (the common args) and $sapi_conf (the SAPI-specific args).
490 local myeconfargs=( "${our_conf[@]}" )
491 myeconfargs+=( "${sapi_conf[@]}" )
493 pushd "${BUILD_DIR}" > /dev/null || die
494 econf "${myeconfargs[@]}"
495 popd > /dev/null || die
500 # snmp seems to run during src_compile, too (bug #324739)
501 addpredict /usr/share/snmp/mibs/.index #nowarn
502 addpredict /var/lib/net-snmp/mib_indexes #nowarn
504 for sapi in ${SAPIS} ; do
505 if use "${sapi}"; then
506 cd "${WORKDIR}/sapis-build/$sapi" || \
507 die "Failed to change dir to ${WORKDIR}/sapis-build/$1"
514 # see bug #324739 for what happens when we don't have that
515 addpredict /usr/share/snmp/mibs/.index #nowarn
517 # grab the first SAPI that got built and install common files from there
519 for sapi in $SAPIS ; do
526 # Makefile forgets to create this before trying to write to it...
527 dodir "${PHP_DESTDIR#${EPREFIX}}/bin"
529 # Install php environment (without any sapis)
530 cd "${WORKDIR}/sapis-build/$first_sapi" || die
531 emake INSTALL_ROOT="${D}" \
532 install-build install-headers install-programs
534 local extension_dir="$("${ED}/${PHP_DESTDIR#${EPREFIX}}/bin/php-config" --extension-dir)"
536 # Create the directory where we'll put version-specific php scripts
537 keepdir "/usr/share/php${PHP_MV}"
539 local sapi="", file=""
542 for sapi in ${SAPIS}; do
543 if use "${sapi}" ; then
544 einfo "Installing SAPI: ${sapi}"
545 cd "${WORKDIR}/sapis-build/${sapi}" || die
547 if [[ "${sapi}" == "apache2" ]] ; then
548 # We're specifically not using emake install-sapi as libtool
549 # may cause unnecessary relink failures (see bug #351266)
550 insinto "${PHP_DESTDIR#${EPREFIX}}/apache2/"
551 newins ".libs/libphp${PHP_MV}$(get_libname)" \
552 "libphp${PHP_MV}$(get_libname)"
553 keepdir "/usr/$(get_libdir)/apache2/modules"
555 # needed each time, php_install_ini would reset it
556 local dest="${PHP_DESTDIR#${EPREFIX}}"
560 source="sapi/cli/php"
563 source="sapi/cgi/php-cgi"
566 source="sapi/fpm/php-fpm"
569 source="libs/libphp${PHP_MV}$(get_libname)"
572 source="sapi/phpdbg/phpdbg"
575 die "unhandled sapi in src_install"
579 if [[ "${source}" == *"$(get_libname)" ]]; then
583 local name="$(basename ${source})"
584 dosym "${dest}/bin/${name}" "/usr/bin/${name}${SLOT}"
588 php_install_ini "${sapi}"
590 # construct correct SAPI string for php-config
591 # thanks to ferringb for the bash voodoo
592 if [[ "${sapi}" == "apache2" ]]; then
593 sapi_list="${sapi_list:+${sapi_list} }apache2handler"
595 sapi_list="${sapi_list:+${sapi_list} }${sapi}"
600 # Installing opcache module
601 if use opcache ; then
602 into "${PHP_DESTDIR#${EPREFIX}}"
603 dolib.so "modules/opcache$(get_libname)"
606 # Install env.d files
607 newenvd "${FILESDIR}/20php5-envd" "20php${SLOT}"
608 sed -e "s|/lib/|/$(get_libdir)/|g" -i "${ED}/etc/env.d/20php${SLOT}" || die
609 sed -e "s|php5|php${SLOT}|g" -i "${ED}/etc/env.d/20php${SLOT}" || die
611 # set php-config variable correctly (bug #278439)
612 sed -e "s:^\(php_sapis=\)\".*\"$:\1\"${sapi_list}\":" -i \
613 "${ED}/usr/$(get_libdir)/php${SLOT}/bin/php-config" || die
617 systemd_newunit "${FILESDIR}/php-fpm_at.service" \
618 "php-fpm@${SLOT}.service"
620 systemd_newunit "${FILESDIR}/php-fpm_at-simple.service" \
621 "php-fpm@${SLOT}.service"
627 echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
628 PHP_BIN="${WORKDIR}/sapis-build/cli/sapi/cli/php"
629 if [[ ! -x "${PHP_BIN}" ]] ; then
630 ewarn "Test phase requires USE=cli, skipping"
633 export TEST_PHP_EXECUTABLE="${PHP_BIN}"
636 if [[ -x "${WORKDIR}/sapis-build/cgi/sapi/cgi/php-cgi" ]] ; then
637 export TEST_PHP_CGI_EXECUTABLE="${WORKDIR}/sapis-build/cgi/sapi/cgi/php-cgi"
640 if [[ -x "${WORKDIR}/sapis-build/phpdbg/sapi/phpdbg/phpdbg" ]] ; then
641 export TEST_PHPDBG_EXECUTABLE="${WORKDIR}/sapis-build/phpdbg/sapi/phpdbg/phpdbg"
644 REPORT_EXIT_STATUS=1 "${TEST_PHP_EXECUTABLE}" -n -d \
645 "session.save_path=${T}" \
646 "${WORKDIR}/sapis-build/cli/run-tests.php" -n -q -d \
647 "session.save_path=${T}"
649 for name in ${EXPECTED_TEST_FAILURES}; do
650 mv "${name}.out" "${name}.out.orig" 2>/dev/null || die
653 local failed="$(find -name '*.out')"
654 if [[ ${failed} != "" ]] ; then
655 ewarn "The following test cases failed unexpectedly:"
656 for name in ${failed}; do
657 ewarn " ${name/.out/}"
660 einfo "No unexpected test failures, all fine"
663 if [[ ${PHP_SHOW_UNEXPECTED_TEST_PASS} == "1" ]] ; then
665 for name in ${EXPECTED_TEST_FAILURES}; do
666 [[ -f "${name}.diff" ]] && continue
667 passed="${passed} ${name}"
669 if [[ ${passed} != "" ]] ; then
670 einfo "The following test cases passed unexpectedly:"
671 for name in ${passed}; do
675 einfo "None of the known-to-fail tests passed, all fine"
681 # Output some general info to the user
682 if use apache2 ; then
684 elog "To enable PHP in apache, you will need to add \"-D PHP\" to"
685 elog "your apache2 command. OpenRC users can append that string to"
686 elog "APACHE2_OPTS in /etc/conf.d/apache2."
688 elog "The apache module configuration file 70_mod_php.conf is"
689 elog "provided (and maintained) by eselect-php."
693 # Create the symlinks for php
694 for m in ${SAPIS}; do
695 [[ ${m} == 'embed' ]] && continue;
697 local ci=$(eselect php show $m)
698 if [[ -z $ci ]]; then
699 eselect php set $m php${SLOT} || die
700 einfo "Switched ${m} to use php:${SLOT}"
702 elif [[ $ci != "php${SLOT}" ]] ; then
703 elog "To switch $m to use php:${SLOT}, run"
704 elog " eselect php set $m php${SLOT}"
710 # Remove dead symlinks for SAPIs that were just disabled. For
711 # example, if the user has the cgi SAPI enabled, then he has an
712 # eselect-php symlink for it. If he later reinstalls PHP with
713 # USE="-cgi", that symlink will break. This call to eselect is
714 # supposed to remove that dead link per bug 572436.
715 eselect php cleanup || die
717 if ! has "php${SLOT/./-}" ${PHP_TARGETS}; then
718 elog "To build extensions for this version of PHP, you will need to"
719 elog "add php${SLOT/./-} to your PHP_TARGETS USE_EXPAND variable."
723 # Warn about the removal of PHP_INI_VERSION if the user has it set.
724 if [[ -n "${PHP_INI_VERSION}" ]]; then
725 ewarn 'The PHP_INI_VERSION variable has been phased out. You may'
726 ewarn 'remove it from your configuration at your convenience. See'
728 ewarn ' https://bugs.gentoo.org/611214'
730 ewarn 'for more information.'
733 elog "For details on how version slotting works, please see"
736 elog " https://wiki.gentoo.org/wiki/PHP"
741 # This serves two purposes. First, if we have just removed the last
742 # installed version of PHP, then this will remove any dead symlinks
743 # belonging to eselect-php. Second, if a user upgrades slots from
744 # (say) 5.6 to 7.0 and depcleans the old slot, then this will update
745 # his existing symlinks to point to the new 7.0 installation. The
746 # latter is bug 432962.
748 # Note: the eselect-php package may not be installed at this point,
749 # so we can't die() if this command fails.