Installation of PHP5 on Gentoo

Submitted by vshivak on Friday, 2004, August 20 - 3:52am

Problem one: uninstalling php4

I recently decided to install php5 on my gentoo machine. As it was a bit tricky I'd thought I'd write some notes about how I finally did it before I forget.

First of all I tried to unmerge php4 because

cd /usr/portage/dev-php/php/ emerge -v php-5.0.1.ebuild

won't run because it's blocked by previous version of php. However,

emerge -Cv php mod_php

won't run because the eclass file php.eclass is missing in /usr/portage/eclass/. Never mind! I made a temporary symlink

cd /usr/portage/class ln -s php-sapi.eclass php.eclass

and ran

emerge -Cv php mod_php

again. That went ok and I had no more old php4 on my machine. I removed symlink

cd /usr/portage/class rm php.eclass

as I did not need it anymore.

Problem two: berkley db dependency on dba

Next step was emerging new php5 and mod_php5

cd /usr/portage/dev-php/php/ emerge -v php-5.0.1.ebuild

First emerge complains about a missing dba argument because by default the berkdb option is switched on. Specifying

export USE=dba

solved the problem. Anyway I noticed that maybe I would like to have some more features enabled in my php5 (session support for example), so I exported some more things

export USE="bzlib exif gd xsl spl dba session simplexml"

Then I emerged mod_php5

cd /usr/portage/dev-php/mod_php/ emerge -v mod_php-5.0.1.ebuild

After emerging I had to run

ebuild /var/db/pkg/dev-php/mod_php-5.0.1/mod_php-5.0.1.ebuild config

to add php5 related things to apache configuration file and I added APACHE_OPTS="-D PHP5" to /etc/conf.d/apache file.

Problem three: apache configuration is not complete

After all of that came the task of convincing apache to run php5. First of all I had to relinked two symlinks. First one in /etc/apache/conf:

ln -sf /etc/php/apache1-php5/php.ini php.ini

and second one in /etc/apache/conf/addon-modules:

ln -sf /etc/php/apache1-php5/php.ini php.ini

However, php5 still didn't want to start because:

# /etc/init.d/apache start * Starting apache... Syntax error on line 59 of /etc/apache/conf/apache.conf: Cannot load /etc/apache/extramodules/libphp5.so into server: /etc/apache/extramodules/libphp5.so: cannot open shared object file: No such file or directory

The solution was quite easy. The installation put libphp5.so in the modules directory, not in the apache extramodules directory. So I had to change it in /etc/apache/conf/apache.conf file on row 59 to:

LoadModule php5_module modules/libphp5.so

And that's all folks! Except for the existence of problem twoI have not found any references to these problems on the internet (according to google) so maybe it was just a problem of my gentoo installation. Even so, I thought I'd write about it because maybe someone else is having the same troubles and can't find a solution. Write me if you have any comments or questions. Cheers!

PDF Version of this article

vshivak

sites

framework.kuziel.infolinks to an external resource.- is my PHP5 open source framework and this is its home page.

kybi.kuziel.infolinks to an external resource.- friend of mine Kybi is traveling to Tibet by bike. I am translating his blog to English. Check it out, it's worth of it.

encode.net.nzlinks to an external resource.- I set up a company called Encode Ltd. Chris Noel is my partner in business. Check out our website if you're interested.

Google
kuziel.info www
---