I need version php 5.4, only it. I can't find how to put it on debian 8 or ubuntu 16. can anyone help?

    3 answers 3

    Simply:

    $ git clone -b PHP-5.4 https://github.com/php/php-src.git $ cd php-src $ ./buildconf $ ./configure $ make $ sudo make install 

    This is a way to compile from source.

    • ./buildconf - ./buildconf: 46: ./buildconf: make: not found - Diefair
    • @Diefair apt-get install make yourself - Naumov

    Try this:

     sudo apt-get install python-software-properties sudo add-apt-repository ppa:ondrej/php5-oldstable sudo apt-get update sudo apt-get install -y php5 
    • doesn't work that way - Diefair

    Use phpbrew - version manager

    Install the dependencies for phpbrew

     apt-get update apt-get upgrade apt-get build-dep php5 apt-get install -y php5 php5-dev php-pear autoconf automake curl build-essential libxslt1-dev re2c libxml2 libxml2-dev php5-cli bison libbz2-dev libreadline-dev apt-get install -y libfreetype6 libfreetype6-dev libpng12-0 libpng12-dev libjpeg-dev libjpeg8-dev libjpeg8 libgd-dev libgd3 libxpm4 libltdl7 libltdl-dev apt-get install -y libssl-dev openssl apt-get install -y gettext libgettextpo-dev libgettextpo0 apt-get install -y php5-cli apt-get install -y libmcrypt-dev apt-get install libicu-dev 

    Install phpbrew

     curl -L -O https://github.com/phpbrew/phpbrew/raw/master/phpbrew chmod +x phpbrew sudo mv phpbrew /usr/bin/phpbrew 

    Initialize phpbrew , update and install PHP 5.4

     phpbrew init phpbrew known --update phpbrew update 

    Now we choose PHP version 5.4.34, But we can choose any other of the available ones - for example 5.5.22.

     phpbrew install 5.4.34 +default 

    Update your shell config file by adding to the end of the file ~ / .bashrc or ~ / .zshrc (depending on which shell you use, the default is .bashrc)

     source ~/.phpbrew/bashrc 

    Change PHP version to 5.4

     phpbrew switch php-5.4.34 

    If the Invalid Argument pops up, try phpbrew switch 5.4.34 . Check the PHP version

     php -v 

    a source

    read to heap

    • There, the answer was written a year ago, and I don’t think it is relevant, since ubuntu was released and php7 is already in the repositories, and there is no php5-dev actually .... - Naumov
    • @Naumov hm, agrees php5-dev drank but phpbrew doesn’t cancel it anyway. It's just that his dependencies probably now have other installation instructions, you can look at the github.com/phpbrew/phpbrew off repository. It will be necessary to update the answer - torokhkun
    • apt-get build-dep php5 - E: You must put some 'source' URIs in your sources.list - Diefair