Unable to find package php 8.0

Solved
albert -  
mamiemando Posted messages 33537 Registration date   Status Modérateur Last intervention   -
Hello,

I wanted to install php8.0 on Debian using:
apt-get install php80
.

Result:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package php8.0


Every time I try to install a package, I get this message about the package not being found. How can I find them?

1 réponse

mamiemando Posted messages 33537 Registration date   Status Modérateur Last intervention   7 927
 
Hello,

First of all, re-index the list of packages known by APT by running as root:

apt update


If you want (but it’s not necessary you can also do an upgrade) as root:

apt upgrade


To search for a package, you can use the command
apt search ...
(as a user or as root), e.g.
apt search php
. Among the (long) list of results, for me there is:

php8.1/testing,testing 8.1.2-1 all
server-side scripting language, included in HTML (meta-package)


... so the command to run to install it would be:

apt install php8.1


If the goal is to do a LAMP installation (Linux Apache MySQL PHP) I recommend running directly:

apt install apache2 default-mysql-server libapache2-mod-php


(the package
libapache2-mod-php
will install the latest version of PHP as a dependency in addition to what is needed for Apache to use PHP).

To go further

Note that there are also two search tools:
  • apt-cache search ...
    (relatively close to
    apt search
    ), allows you to search within the packages and their description for a keyword;
  • apt-file search ...
    (not installed by default) allows you to search within the list of files provided by each package (very useful when you're looking for which package provides a command). Typically, to search for the package that provides the command
    ls
    you would run
    apt-file search ls | grep bin/ls$
    and you would find that it’s the package
    coreutils
    ... Note that in the
    grep
    I wrote
    bin/
    which helps to retain all paths that may contain a binary (in the sense of the FHS)
    /bin
    ,
    /sbin
    ,
    /usr/bin
    ,
    /usr/sbin
    .


Good luck
2