Score:1

How install php7.4.11 in ubuntu

in flag

I downloaded php-7.4.11.tar.gz for the installation manual, but after extracting and entering make, the following message is displayed in the terminal:

make: *** No targets specified and no makefile found. Stop.

~/php-7.4.11$ ls
appveyor             buildconf            config.nice      docs        libs                Makefile.objects     php.ini-production  sapi     TSRM                 Zend
azure                buildconf.bat        configure        ext         LICENSE             NEWS                 README.md           scripts  UPGRADING
azure-pipelines.yml  CODING_STANDARDS.md  configure.ac     EXTENSIONS  main                pear                 README.REDIST.BINS  tests    UPGRADING.INTERNALS
build                config.log           CONTRIBUTING.md  include     Makefile.fragments  php.ini-development  run-tests.php       travis   win32


N0rbert avatar
zw flag
Bicycles are cool, invent more. What was wrong with normal official [php deb package](https://packages.ubuntu.com/search?suite=all&exact=1&searchon=names&keywords=php)?
Ranaa avatar
in flag
When I open the php page‍‍`Your Composer dependencies require a PHP version "> = 7.4.11". You are running 7.4.3.`
N0rbert avatar
zw flag
What is your Ubuntu version?
Ranaa avatar
in flag
Ubuntu v : 20.04
Score:2
in flag

In order to have a version of PHP 7.4 greater than 7.4.3, you will need to use Ondřej Surý's PPA. This will give you 7.4.27 if you are running Ubuntu 18.04, 20.04, 21.04, or 21.10. Fortunately, it's not too difficult to do.

WARNING: You need to understand that by following these steps, the web server will be OFFLINE during the PHP version change. You will be uninstalling 7.4.3 and installing 7.4.27, which does take a couple of minutes. If you are doing this on a production machine that does not have any spare for maintenance, your visitors will need to understand the error(s) they see are temporary.

With that out of the way, let's get started.

If you are updating an existing workstation/server:

  1. Open Terminal or connect to the server where you need 7.4.27

  2. Stop Apache:

    sudo service apache2 stop
    

    Note: This technically is not required, but it's just "cleaner".

  3. Uninstall all PHP packages on your machine:

    sudo apt purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`
    

    Source

    NOTE: Read the packages that are going to be uninstalled and be sure that the list is correct before continuing. If you do not agree with the list, then STOP.

  4. Once the packages are removed, clean apt:

    sudo apt clean 
    

Now that PHP has been removed from the system, let's continue.

Installing Ondřej Surý's version of PHP:

  1. Open Terminal or connect to the server where you need 7.4.27

  2. Ensure Apache is not running:

    sudo service apache2 stop
    

    Note: This technically is not required, but it's just "cleaner". Of course, if Apache isn't installed, you don't need to do this.

  3. Add the appropriate PPA:

    sudo add-apt-repository ppa:ondrej/php
    
  4. Update apt:

    sudo apt update
    
  5. Install PHP 7.4.27:

    sudo apt install php7.4
    

    Note: While the package states 7.4, this will give you 7.4.27-1+ubuntu20.04.1+deb.sury.org+1 on 20.04 (as of this writing).

    Of course, feel free to add any other PHP packages that you may need, but keep in mind that you must specifically specify the major and minor versions for every additional package. For example:

    sudo apt install php7.4 php7.4-json php7.4-xml php7.4-mbstring ...
    
  6. Once complete, confirm the installed version:

    $ php -v
    PHP 7.4.27 (cli) (built: Nov 25 2021 23:16:22) ( NTS )
    Copyright (c) The PHP Group ...
    
  7. Start/Restart Apache (if that's the web server you're using):

    sudo service apache2 start
    

Now you're using a fully up-to-date version of PHP 7.4.x, which will receive security updates until November 28, 2022. Hopefully by then there will be a plan for you to upgrade to PHP 8.0 or 8.1.

Ranaa avatar
in flag
Thank you, I running `sudo apt install php7.4.11` but I get this error: ‍‍‍‍`Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package php7.4.11 E: Couldn't find any package by glob 'php7.4.11' `
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.