Upgraded to PHP5 on Gentoo

In: PHP

6 Sep 2004

Yup I just upgraded from PHP4.3.8 to PHP5.0.1 on the Gentoo VPS hosting this weblog. It went rather smoothly, except for an oversight where I actually forgot to compile PHP with session support (and had to re-compile it). Just unmerge the existing PHP and mod_php packages, and emerge them again from ebuilds.

emerge unmerge php mod_php
emerge -pv /usr/portage/dev-php/php/php-5.0.1.ebuild
USE=”curl session mysql postgres zlib ldap” emerge -v /usr/portage/dev-php/php/php-5.0.1.ebuild
emerge -pv /usr/portage/dev-php/mod_php/mod_php-5.0.1.ebuild
USE=”curl session mysql postgres zlib ldap” emerge -v /usr/portage/dev-php/mod_php/mod_php-5.0.1.ebuild

No configuration needed beyond commenting out the LoadModule directive (for PHP4) in the Apache configuration file and changing the Apache startup options (in /etc/conf.d/apache2):

#APACHE2_OPTS=”-D SSL -D PHP4″
APACHE2_OPTS=”-D SSL -D PHP5″

A restart of Apache2 is all that’s left.

I’m not sure if I left any essential stuff out in the USE flags (which roughly translates into configure options) I used so if anyone would be so kind to skim through my phpinfo() and let me know, I’d be grateful and will be sure to return the favor. Some of the USE flags/configure options are pretty self-explanatory but I have no idea what the rest really do. What does excluding the truetype flag mean? Does it mean I don’t get TrueType font support when dynamically generating images (with gd)? What about the pcre flag? If I don’t compile with pcre, does that mean no preg_* functions for me? Point me to an explanatory page please (I have been looking).

10 Responses to Upgraded to PHP5 on Gentoo

Avatar

Phil Ringnalda

September 6th, 2004 at 10am

I’ve never seen a decent explanation, which is why I tend to go overboard. The things that jump out at me that I would want are simplexml, tidy, xsl, and sqlite (mostly just to be able to develop things for distribution to people without MySQL, and because it’s cute). Dunno about xmlrpc – I’ve never used the builtin stuff, since there are plenty of good external libraries.

Avatar

David Chen

September 6th, 2004 at 11am

Though I don’t know of a page that provides details, perhaps these little bits of information may prove helpful if you don’t already know about it. If you run ’emerge -pv packagename‘, the command will tell you what use flags the package supports. Though, php has a ton of possible flags. For easy setting and unsetting of flags (plus short descriptions), emerge the utility ‘ufed’. Use-flag editor!

Avatar

David Chen

September 6th, 2004 at 11am

Oops, you already knew about the -pv flag. Sorry about that! Hope ufed is still useful to you!

Avatar

Cheah Chu Yeow

September 6th, 2004 at 11am

Phil: Exactly. I used to go overboard as well, but decided to go clean instead this time since all I’d need to do is to re-emerge PHP. I just checked out SimpleXML on PHP.net and that seems like it could really be useful in something I’d be doing a little bit down the road.

Yup David I knew about that –pretend (-p) option, just didn’t know exactly what the flags were for in some cases. Didn’t know about ‘ufed’ though – will be sure to check it out. Thanks.

Avatar

DrTebi

September 16th, 2004 at 10am

Thank you so much for you post, it inspired me to install PHP5 as well through emerge instead of building it from source.

Regarding your phpinfo(), I think everything looks just fine. For some reason I had to add “ftp” and “xsl” to my USE flags as well though.
This is the USE flag I am using:
USE=”ftp exif xsl session -berkdb -gdbm -nls -ssl -sasl”
exif: I want to use it to get info from digital images
xsl: I love it
-berkdb: I don’t need it, since there is sqlite now, that would be my choice over berkeley db functions
-gdbm: same as above
-nls: native language support, to internationalize scripts–I don’t think I will need it, and people seem to have a lot of trouble with it
-ssl: I don’t think I will be dealing with certificate reading , creating etc.
-sasl: I don’t think I will use directory servers

To find out what the switches do and to what PHP configure option they relate to, you can browse through the file /usr/portage/eclass/php5-sapi.eclass. If that’s not explanatory, try this google search for example:
site:php.net Requirements tokenizer
and you should get the manual page explaining the extension.

With truetype for example means that emerge would check if the freetype library is installed (emerge it if necessary), and enable the creation of images with true-type fonts.

Well, my test server here is still compiling… wish me luck :)
DrTebi

Avatar

milkfilk

November 10th, 2004 at 2am

Anyone have an comments as to the advantages of PHP5? I mean, why did you upgrade?

Avatar

bosshoff

February 23rd, 2005 at 12am

Isn’t php5 still buggy? And I heard they cut a lot of things out from what was proposed, such as nested classes; I could really use that.

Avatar

jhoff

February 27th, 2005 at 12pm

Thanks alot for this… I’ve been trying to figure out why sessions and curl are disabled, and this helped tremendously. I tend to look for the hardest solution first, instead of the easier ones. I was actually to the point of trying to figure out how to modify the default ebuild configure flags to –enable-session and –with-curl, but gave up half way. Proof that many minds are better than one.

On the subject of nifty portage utilities, I always got tired of waiting for emerge to search for stuff… emerge esearch. It will index your ebuilds and provide almost instant searching of ebuilds.

Thanks again
jhoff

Avatar

buy viagra online

July 10th, 2005 at 2am

buy viagra online

buy viagra online Those who cannot remember the past are condemned to repeat it.

Avatar

gambling

July 10th, 2005 at 11pm

gambling

gambling The history of the world is none other than the progress of the consciousness of spirit.