1

I have recently been put in charge of keeping an eye on the servers (we don't have a server admin) and I just realized that we are running a pretty old version of php which has multiple vulnerabilities according to http://lwn.net/Alerts/609952/. I would like to update to the latest stable version but I'm not sure if there's anything else I should do besides these 2 commands:

emerge --sync

emerge --ask --oneshot --verbose "=dev-lang/php-5.5.17

Do I have to recompile php? is there any other step to get it working with apache?

I would really appreciate some help as I'm not very familiar with Gentoo.

1
  • php-5.5.17 is still considered unstable on gentoo. If you want the latest stable version for gentoo (5.5.16), you should just have to run emerge --sync followed by emerge -u --ask php. Commented Oct 16, 2014 at 5:47

1 Answer 1

1

To update PHP on Gentoo:

(More on the subject: Gentoo PHP documentation).

  1. Sync your portage tree: emerge --sync

  2. Instruct emerge to use PHP-5.5: add following to your make.conf: PHP_TARGETS="php5-5"

  3. Switch to new PHP version. If you have been running PHP-5.4 and now want to start using PHP-5.5 then you need to instruct the system to start using PHP-5.5. Use eselect php command to do so.

  4. Emerge new PHP version: emerge --ask php

  5. Update config files: run dispatch-conf to properly update your PHP config files. This will remove old/unsupported items and add new items to config files.

  6. Restart your Web server or PHP interpreter (in case you use PHP-FPM): If you use apache which was installed with emerge then it will be /etc/init.d/apache2 restart. In case of PHP-FPM it will be /etc/init.d/php-fpm restart.

This should be sufficient to update PHP on your Gentoo system.

You can check what PHP version is currently being used by creating a page with following content:

<?php phpinfo();

Save this page somewhere in your Web server document tree (make sure it is not accessible by anyone except you), open it in your browser and you will be able to see what PHP version is being used. Delete the page afterwards.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .