Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debian wheezy upgrade php 5.4 to 5.5

Tags:

php

debian

[solved]

I have Debian Wheezy with installed php 5.4.18. I wanted upgrade it to 5.5.x, but standard procedure not working.

This is my /etc/apt/sources.list file:

# deb cdrom:[Debian GNU/Linux 7.0.0 _Wheezy_ - Official amd64 NETINST Binary-1 20130504-14:43]/ wheezy main
deb http://ftp.pl.debian.org/debian/ wheezy main
deb-src http://ftp.pl.debian.org/debian/ wheezy main

deb http://security.debian.org/ wheezy/updates main
deb-src http://security.debian.org/ wheezy/updates main

# wheezy-updates, previously known as 'volatile'
deb http://ftp.pl.debian.org/debian/ wheezy-updates main
deb-src http://ftp.pl.debian.org/debian/ wheezy-updates main

#php 5.5
deb http://packages.dotdeb.org wheezy-php55 all
deb-src http://packages.dotdeb.org wheezy-php55 all

I updated sources with

apt-get update

and installed php5

apt-get install php5

but after httpd restart i still have old php version.

php -v

returns:

root@xxx:/# php -v
PHP 5.4.18 (cli) (built: Aug 19 2013 04:03:40)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
    with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans

when I searching php

find / -name php5

I can see just installed files

root@xxx:/usr/bin# ls -l php*
lrwxrwxrwx 1 root root      21 Dec 11 00:15 php -> /etc/alternatives/php
-rwxr-xr-x 1 root root 8956912 Nov 17 02:37 php5
root@xxx:/usr/bin# ./php5 -v
PHP 5.5.19-1~dotdeb.1 (cli) (built: Nov 17 2014 01:24:08)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies
    with Xdebug v2.2.6, Copyright (c) 2002-2014, by Derick Rethans
root@xxxx:/usr/bin# ./php -v
PHP 5.5.19-1~dotdeb.1 (cli) (built: Nov 17 2014 01:24:08)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies
    with Xdebug v2.2.6, Copyright (c) 2002-2014, by Derick Rethans

My phpinfo returns PHP Version 5.4.18

What I'm doing wrong?

//edit: I updated it by directadmin/custombuild

root@xxxx:/usr/local/directadmin/custombuild# vim options.conf

i changed line:

php1_release=5.4

to

php1_release=5.5

and next:

root@xxxx:/usr/local/directadmin/custombuild# ./build update_data
# [..]
root@xxxx:/usr/local/directadmin/custombuild# ./build php d
# [..]

Now I have php 5.5.19, and I can use password_hash() function ;)

like image 413
marcin110987 Avatar asked Dec 11 '14 00:12

marcin110987


1 Answers

  1. Add these package sources to your sources.list file: Enter the file via

    sudo nano /etc/apt/sources.list

and add these lines at the end of the file (right click pastes):

deb http://packages.dotdeb.org wheezy-php55 all
deb-src http://packages.dotdeb.org wheezy-php55 all

Save and close (CTRL-X, “y”, ENTER).

  1. Do an update:

    sudo apt-get update

You’ll get an error message in the last line of the update progress now.

  1. It’s not possible to install PHP now, as Debian just gave an error and said that these new sources are not verified and blah blah, the public key is not available… I find this process highly unintutive and I really don’t know why it’s so complicated to update PHP, but well, that’s how it is…

Method #1 The last line of this error message contains a key, like “E9C74FEEA2098A6E”. Copy that key (mark the string with the mouse usually copies it into the clipboard) and run these commands to verifiy the new package sources (and put YOUR key in here):

gpg --keyserver packages.dotdeb.org --recv-key  E9C74FEEA2098A6E
gpg -a --export E9C74FEEA2098A6E | sudo apt-key add -

Method #2 (thanks Petr for bringing this in!)

wget http://www.dotdeb.org/dotdeb.gpg
sudo apt-key add dotdeb.gpg
  1. Do an update again:

    sudo apt-get update

  2. Install the latest version of PHP 5:

    sudo apt-get install php5

  3. Check the installed version of PHP 5 (phpinfo() will still show old PHP version until apache restart):

    php -v

Finally, restart the apache:

sudo service apache2 restart

By the way, it’s not possible (as far as I know) to install PHP 5.5 on Debian 6 (without compiling source code manually).

like image 180
Amir Hassan Azimi Avatar answered Nov 02 '22 06:11

Amir Hassan Azimi