Today I again was annoyed by Gentoos handling of PHP through its packaging system Portage. I love portage above everything else, believe me, but the PHP package sucks. Although it compiles really well and is very easy to configure (hey, thanks Sebastian and all the other maintainers!), Gentoo seems to have an issue with enabling certain compiling options by default. If you don't set any of the USE flags (configuration options for compiling packages through Portage) for PHP, it will simply compile with --disable-all and is completly unusable.
I discovered this when first time compiling PHP through Portage (about 2 weeks ago), because I wanted to test installing eZ components through it (and those logically depend on PHP). I had to add the USE flags "session", "pcre" and "spl" there, to get a half-way usable PHP. With my upgrade yesterday, Portage installed PHP 5.1.2, where also Reflection is an optional feature (I have no clue why and it sucks, IMO). Therefore I again had to add "reflection" to my flags for PHP compilation.
I know, this is not the fault of Sebastian and the other maintainers of PHP in Gentoo, but a general problem with Gentoo's policies here, although I have no clue, where the issue could be when adding at least the most basic flags by default (if someone really wants a smaller distribution, he can always remove the flags). Most distributions (e.g. RedHat, Suse and Debian) provide a much to oversized PHP or provide all extensions as precompiled loadable modules. This mostly sucks, too, why I tend to compile PHP always from scratch. But in heavy contrast you receive a completly unusable PHP from Gentoo, by default, which sucks even more.
You Gentoo guys: I really love your distribution and I pay high tribute to you for all the greatnesses. But please, make PHP usable by default. Thanks!
If you liked this blog post or learned something, please consider using flattr to contribute back: .
Fields with bold names are mandatory.
Andreas Korthaus
I think this is by design, the PHP ebuilds provide a USE flag for almost every bundled php extension. If you don't change any USE flags, the default USE flags of your profile and your changes to /etc/make.conf will define the USE flags for you. And if you don't have set "reflection" there, it will not be compiled in.
Link to commentIf you install something on Gentoo, you usually do something like "emerge -pv dev-lang/php" before. This will show you something like:
[ebuild N ] dev-lang/php-5.1.3_rc1 -adabas -apache +apache2 +bcmath -berkdb -birdstep -bzip2 -calendar -cdb -cgi -cjk +cli +crypt +ctype -curl -curlwrappers -db2 -dba -dbase -dbmaker -debug -discard-path -doc -empress -empress-bcs -esoob -exif +fastbuild -fdftk -filepro -firebird -flatfile -force-cgi-redirect -frontbase -ftp +gd -gd-external -gdbm -gmp -hardenedphp +hash -hyperwave-api +iconv +imap -informix -inifile -interbase -iodbc +ipv6 -java-external -kerberos -ldap -libedit -mcve +memlimit +mhash -ming -msql -mssql +mysql -mysqli -ncurses +nls -oci8 -oci8-instant-client -odbc -pcntl +pcre -pdo -pdo-external -pic -posix -postgres -qdbm +readline -recode -reflection -sapdb -sasl +session -sharedext -sharedmem +simplexml -snmp +soap -sockets -solid -spell +spl +sqlite +ssl -sybase -sybase-ct -sysvipc -threads -tidy -tokenizer +truetype -vm-goto -vm-switch -wddx +xml +xmlreader -xmlrpc +xmlwriter -xpm -xsl -yaz -zip +zlib 0 kB [2]
Total size of downloads: 0 kB
Portage overlays:
[1] /usr/local/gentoo-php-overlay/experimental
[2] /usr/local/gentoo-php-overlay/testing
So you only have to look at the available USE flags (really easy to map to php extensions), and if you want to enable/disable something else, add it to "/etc/portage/package.use", e.g.:
dev-lang/php curl hardenedphp oci8-instant-client pdo reflection -readline...
Recommended USE flags (defaults) can be found here: http://svn.gnqs.org/projects/gentoo-php-overlay/wiki/CommonQuestions#DoYouRecommendAnyUSEFlags" title="http://svn.gnqs.org/projects/gentoo-php-overlay/wiki/CommonQuestions#DoYouRecommendAnyUSEFlags">http://svn.gnqs.org/projects/gentoo-php-overlay/wiki/CommonQuestions#DoYouRecommendAnyUSEFlags
That's perhaps not the easiest way if you install it for the first time, but it's very flexible! I really don't need to compile PHP by myself anymore (you even can install PHP4 and PHP5 in parallel!) and it is well maintained by Gentoo and integrated in the distributions package management portage.
For more information and docs or if you have good ideas how to make things better, have a look at:
http://www.gentoo.org/proj/en/php/
http://svn.gnqs.org/projects/gentoo-php-overlay (e.g. allready provides a PHP 5.1.3RC1 ebuild)
best regards
Andreas
Shawn Lauriat
In its defense (sort of), it did teach me the hard way that you can compile PHP5 without the standard PHP library.
Link to commentAvuton Olrich
I have to disagree. They can't change your USE flags for you. USE flags are the reason I'm able to run this on such a slow computer. Maybe they should put a fat warning for those that compile with no USE flags, but definitely not choose USE flags for me.
Link to commentShawn Lauriat
BTW: I just upgraded to 5.1.2 and portage really, really wants to turn magic_quotes_gpc back on. Just a warning...
Link to commentToby
I really have nothing against portage and against the philosophy of not having all those extensions activated by default. Infact I appreciate it! But per deafult, it shall build a uable PHP, which means for me, just running "./configure" and not "./configure --disable-all". "--disable-all" makes the actuall PHP really unusable. You loose SPL and Reflection, which are major additions in PHP5 and therefore should be enabled by default.
Link to commentGuys, I don't want to make you an overblown default PHP, but to make the default being the default. If really someone wants to disable SPL or reflection he can use "-SPL" or "-REFLECTION" as the useflag. But at least 99% of the people want to have those features. When I upgraded PHP last time, reflection misteriously disappeared and that kinda stuff really annoys me.
So the conclusion should be: Keep it with the default configure and not force "--disable-all" as our default.
P.S.: Note, these are only my .2.
Avuton Olrich
OK, riddle me this. How is this not a php bug if --disable-all is part of their distribution. Also, --disable-all is not the 'default'; if you don't edit your own use flags after install you're skipping a major step to installing the gentoo distribution.
Link to commentToby
I fully agree that defining your useflags is a major step in a Gentoo installation, but nevertheless, I would not come to the idea that I have to specify tons of useflags get a normal PHP. If you emerge VIM, do you then have regex disabled by default?
Link to commentGentoo
Me like gentoo!
Link to commenthttp://pinterest.com/birthdaygift01/
In addition to providing unique gift ideas, we also offer many free services for members.
Link to comment