Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 71359 - mod_php conflicts with php: Files in /usr/lib/php/extensions
Summary: mod_php conflicts with php: Files in /usr/lib/php/extensions
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: PHP Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-15 23:10 UTC by Alexander Skwar
Modified: 2005-08-22 11:52 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Skwar 2004-11-15 23:10:32 UTC
I installed apache2 with USE=-threads. After that, I installed PHP with the following flags:

08:01:06 askwar@alturo:~ $ sudo emerge -vp php

These are the packages that I would merge, in order:

Calculating dependencies ...done!
[ebuild   R   ] dev-php/php-5.0.2-r1  -adabas +bcmath +berkdb -birdstep +bzlib +calendar -cdb -cpdflib +crypt -ctype +curl +curlwrappers -db2 +dba -dbase -dbm -dbmaker -dbx -debug -dio -empress -empress-bcs -esoob +exif +fam -fdftk -filepro -flatfile -frontbase +ftp +gd -gd-external +gdbm +gmp -hyperwave-api +iconv -imap -informix -ingres +inifile -interbase -iodbc +jpeg +ldap +libedit -mcve -memlimit +mhash +mime +ming -mnogosearch -msession -msql -mssql +mysql -mysqli +ncurses -nis +nls -oci8 -odbc -oracle7 -ovrimos +pcntl +pcre -pfpro +png +posix +postgres -qdbm -readline -recode -sapdb +sasl +session +shared +sharedmem -simplexml -snmp +soap +sockets -solid +spell -spl -sqlite +ssl -sybase -sybase-ct +sysvipc +tidy +tiff -tokenizer +truetype -wddx +xml2 +xmlrpc -xpm +xsl +zlib 0 kB

Total size of downloads: 0 kB


Next, I tried to install mod_php with:

08:01:40 askwar@alturo:~ $ sudo emerge -vp mod_php

These are the packages that I would merge, in order:

Calculating dependencies ...done!
[ebuild  N    ] dev-php/mod_php-5.0.2  -adabas +apache2 +bcmath +berkdb -birdstep +bzlib +calendar -cdb -cpdflib +crypt -ctype +curl +curlwrappers -db2 +dba -dbase -dbm -dbmaker -dbx -debug -dio -empress -empress-bcs -esoob +exif +fam -fdftk -filepro -flatfile -frontbase +ftp +gd -gd-external +gdbm +gmp -hyperwave-api +iconv -imap -informix -ingres +inifile -interbase -iodbc +jpeg +ldap -libedit -mcve -memlimit +mhash +mime +ming -mnogosearch -msession -msql -mssql +mysql -mysqli +ncurses -nis +nls -oci8 -odbc -oracle7 -ovrimos +pcntl +pcre -pfpro +png +posix +postgres -qdbm +readline -recode -sapdb +sasl +session +shared +sharedmem -simplexml -snmp +soap +sockets -solid +spell -spl -sqlite +ssl -sybase -sybase-ct +sysvipc +tidy +tiff -tokenizer +truetype -wddx +xml2 +xmlrpc -xpm +xsl +zlib 0 kB

Total size of downloads: 0 kB


Actually, I only tried to install mod_php, which first installed php and afterwards tried to install mod_php.


After I emerged mod_php, I got the following error messages:

>>> Completed installing into /var/tmp/portage/mod_php-5.0.2/image/

* checking 34 files for package collisions
existing file /usr/lib/php/extensions/no-debug-non-zts-20040412/openssl.so is not owned by this package
existing file /usr/lib/php/extensions/no-debug-non-zts-20040412/calendar.so is not owned by this package
existing file /usr/lib/php/extensions/no-debug-non-zts-20040412/curl.so is not owned by this package
existing file /usr/lib/php/extensions/no-debug-non-zts-20040412/ldap.so is not owned by this package
existing file /usr/lib/php/extensions/no-debug-non-zts-20040412/pgsql.so is not owned by this package
existing file /usr/lib/php/extensions/no-debug-non-zts-20040412/mhash.so is not owned by this package
existing file /usr/lib/php/extensions/no-debug-non-zts-20040412/bcmath.so is not owned by this package
existing file /usr/lib/php/extensions/no-debug-non-zts-20040412/iconv.so is not owned by this package
existing file /usr/lib/php/extensions/no-debug-non-zts-20040412/zlib.so is not owned by this package
existing file /usr/lib/php/extensions/no-debug-non-zts-20040412/soap.so is not owned by this package
existing file /usr/lib/php/extensions/no-debug-non-zts-20040412/ming.so is not owned by this package
existing file /usr/lib/php/extensions/no-debug-non-zts-20040412/gettext.so is not owned by this package
existing file /usr/lib/php/extensions/no-debug-non-zts-20040412/tidy.so is not owned by this package
existing file /usr/lib/php/extensions/no-debug-non-zts-20040412/exif.so is not owned by this package
existing file /usr/lib/php/extensions/no-debug-non-zts-20040412/bz2.so is not owned by this package
existing file /usr/lib/php/extensions/no-debug-non-zts-20040412/dba.so is not owned by this package
existing file /usr/lib/php/extensions/no-debug-non-zts-20040412/fam.so is not owned by this package
existing file /usr/lib/php/extensions/no-debug-non-zts-20040412/pspell.so is not owned by this package
existing file /usr/lib/php/extensions/no-debug-non-zts-20040412/ftp.so is not owned by this package
existing file /usr/lib/php/extensions/no-debug-non-zts-20040412/ncurses.so is not owned by this package
existing file /usr/lib/php/extensions/no-debug-non-zts-20040412/gmp.so is not owned by this package
existing file /usr/lib/php/extensions/no-debug-non-zts-20040412/mbstring.so is not owned by this package
existing file /usr/lib/php/extensions/no-debug-non-zts-20040412/mcrypt.so is not owned by this package
existing file /usr/lib/php/extensions/no-debug-non-zts-20040412/sockets.so is not owned by this package
existing file /usr/lib/php/extensions/no-debug-non-zts-20040412/pcntl.so is not owned by this package
existing file /usr/lib/php/extensions/no-debug-non-zts-20040412/xsl.so is not owned by this package
existing file /usr/lib/php/extensions/no-debug-non-zts-20040412/sysvmsg.so is not owned by this package
existing file /usr/lib/php/extensions/no-debug-non-zts-20040412/sysvsem.so is not owned by this package
existing file /usr/lib/php/extensions/no-debug-non-zts-20040412/sysvshm.so is not owned by this package
existing file /usr/lib/php/extensions/no-debug-non-zts-20040412/xmlrpc.so is not owned by this package
existing file /usr/lib/php/extensions/no-debug-non-zts-20040412/mysql.so is not owned by this package


I see two possible solutions for this bug:

Either, there's a "master" php package which installs the module for *all of* "php-cli", "php-cgi" and "php-mod" (mod_php) or each package should install the extensions into seperate directories (like /usr/lib/php/{php-mod,php-cli,php-cgi}), so that they don't get overwritten.

The first approach would make the compilation easier. The different php packages (php-cli, php-mod and php-cgi) wouldn't (or actually, in this case shouldn't even) need to support all those USE flags.

The second approach would allow to have differently compiled PHP versions around. For example, most of the time it doesn't make that much sense to have readline/libedit compiled into mod_php - but it makes a heck of a lot sense to have it in php-cli. Or different CFLAGS. Or different gcc versions.


However, deleting the extensions from mod_php before they get installed is not such a good solution.



Reproducible: Always
Steps to Reproduce:




08:01:44 askwar@alturo:~ $ sudo emerge info
Portage 2.0.51-r3 (default-linux/x86/2004.3, gcc-3.4.3, glibc-2.3.4.20041102-r0,
2.6.9-gentoo-r3.PHP2.4kb.cleaned.no-preempt.05 i686)
=================================================================
System uname: 2.6.9-gentoo-r3.PHP2.4kb.cleaned.no-preempt.05 i686 Intel(R)
Celeron(R) CPU 2.00GHz
Gentoo Base System version 1.6.6
ccache version 2.3 [enabled]
Autoconf: sys-devel/autoconf-2.59-r5
Automake: sys-devel/automake-1.8.5-r1
Binutils: sys-devel/binutils-2.15.92.0.2-r1
Headers:  sys-kernel/linux26-headers-2.6.8.1-r1
Libtools: sys-devel/libtool-1.5.2-r7
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CFLAGS="-march=pentium4 -O2 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
COMPILER=""
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config
/usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-fomit-frame-pointer -pipe -O2 -march=pentium4"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache collision-protect distlocks sandbox sfperms"
GENTOO_MIRRORS="http://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/
ftp://mirrors.sec.informatik.tu-darmstadt.de/gentoo/
ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo
ftp://ftp.wh2.tu-dresden.de/pub/mirrors/gentoo http://194.117.158.29/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="acl apache2 apm arts async avi bzlib crypt cscope cups curl curlwrappers
diet djbfft encode exif fam flash foomaticdb ftp fwdzone gd gdbm gif hal
hardened iconv imagemagick imap imlib immqt-bc ithreads javascript jpeg ldap
libedit libg++ libwww lzo lzw lzw-tiff mad maildir mailwrapper mbox mmap mmx mng
mpeg mysql ncurses nls no-old-linux noantlr nobcel nobeanutils nobsh
nocommonslogging nocommonsnet nojdepend nojsch nojython nolog4j nooro noregexp
norhino noxalan noxerces nptl offensive oggvorbis opengl oss pam parse-clocks
pcntl pcre pdflib perl pic pie png posix postgres pwdb python qt quicktime
readline recode sasl sdl shared slang sockets spell sse ssl sysvipc tcpd tiff
truetype unicode vhosts x86 xfs xml2 xmms xv zlib linguas_de"
Comment 1 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2004-11-15 23:40:38 UTC
solution A (a master PHP package) doesn't work, as depending on some configure options, the modules can very easily be incompatible between the various parts of PHP (I can think of at least 6 seperate routes that this can happen from what I know of the PHP source).

back in the days of php4 we didn't compile readline/libedit into mod_php/php-cgi, but it ended up causing more hassles than it was worth in a few ways, and we integrated it back in as of PHP5.

The best route performance-wise with PHP is not to use the shared USE flag at all, and instead to specify exactly what extensions you want for each PHP via /etc/portage/package.use.

For extensions, I'm thinking the best route would be to put extensions into
"/usr/lib/php/extensions/${PHPSAPI}-php${PV/.*}/..." but this brings up the problem that third-party modules need to be made to put themselves in multiple locations after this.
Comment 2 awk 2004-11-16 09:39:46 UTC
This is basically the same problem as in #71095. The different PHP ebuilds should never install the same files to the same locations (though I never saw that error message that Alexander reports).

Re the modules: can you put third-party modules in a /usr/lib/php/extensions/shared dir and load via a full path?

And maybe it would be better to add the config to the .ini files, but commented out, so they have to be edited by the admin before the new module is activated. For instance a PHP accelerator doesn't need to be active in the CLI .ini.
Comment 3 Stuart Herbert (RETIRED) gentoo-dev 2004-11-17 05:22:59 UTC
As much as I hate the idea, it might be time for us to start looking at having a single dev-php/php package, where you switch the SAPIs on and off via USE flags.  For the cost of a (one-off) manual upgrade for users, we should be able to ensure that problems like this simply can't happen.  And PHP will install quicker too, because users won't need to recompile PHP multiple times.

The downside is loss of flexibility.  All the SAPIs would end up being installed with the same options.  I guess we need to find out whether that really matters or not.

Best regards,
Stu
Comment 4 Alexander Skwar 2004-11-17 06:11:09 UTC
But please DO NOT drop support for installing multiple SAPIs at the same time! I need to be able to have both mod_php and the PHP cli installed. Others might need cli and CGI.
Comment 5 awk 2004-11-17 08:14:12 UTC
If you can keep the ability for each PHP to use its own php.ini file then I don't see why somebody couldn't just comment out any unwanted modules. Assuming that all the built-in modules are compiled dynamically like they appear to be with the PHP5 eclass.

Even if you can't do that, there is a hack in PHP CLI that looks for "php-cli.ini" before "php.ini". In my applications I only need the CLI version to be configured differently because of session directory ownership issues, and a couple other minor tweaks. I might not even need those any more, I haven't tested recently.

Judging by the /usr/bin/php bugs I reported, it looks like most people don't configure their PHP's differently, probably using the stock .ini's and presumably the same USE flags.
Comment 6 Stuart Herbert (RETIRED) gentoo-dev 2005-08-22 11:52:05 UTC
Hi,

This is now fixed by the packages in the Gentoo PHP Overlay.  I went down the
single dev-lang/php route, and am very happy with the new approach.  These
packages will be available in Portage in the next few weeks, but the overlay is
available for general use now.

[1] http://svn.gnqs.org/projects/gentoo-php-overlay/

Best regards,
Stu