How to install php in Linux (Debian) on ChromeBook?

I am trying to install php in the Linux I set up, on my Chromebook,when activating developer mode. But, somehow it does seem to be working, despite a couple attempts on two different approaches:

  1. Followed the link but I got this output:

    njtmendes@penguin:~$ sudo apt install -y php7.4 php7.4-cli php7.4-common
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    E: Unable to locate package php7.4
    E: Couldn't find any package by glob 'php7.4'
    E: Couldn't find any package by regex 'php7.4'
    E: Unable to locate package php7.4-cli
    E: Couldn't find any package by glob 'php7.4-cli'
    E: Couldn't find any package by regex 'php7.4-cli'
    E: Unable to locate package php7.4-common
    E: Couldn't find any package by glob 'php7.4-common'
    E: Couldn't find any package by regex 'php7.4-common'
    njtmendes@penguin:~$ ^C
    njtmendes@penguin:~$ php -v
    -bash: php: command not found
    njtmendes@penguin:~$ ^C
    njtmendes@penguin:~$
  2. I tried the solution above with the expectation of tweaking for Debiam but still doesn't work

    output:

    [6:16 pm, 28/04/2020] Nuno Da Elizabeth: njtmendes@penguin:~$ sudo add-apt-repository ppa:ondrej/php Co-installable PHP versions: PHP 5.6, PHP 7.x and most requested extensions are included. Only Supported Versions of PHP () for Supported Ubuntu Releases () are provided. Don't ask for end-of-life PHP versions or Ubuntu release, they won't be provided.
    Debian oldstable and stable packages are provided as well:
    You can get more information about the packages at
    BUGS&FEATURES: This PPA now has a issue tracker:
    CAVEATS:
    1. If you are using php-gearman, you need to add ppa:ondrej/pkg-gearman
    2. If you are using apache2, you are advised to add ppa:ondrej/apache2
    3. If you are using nginx, you are advise to add ppa:ondrej/nginx-mainline
       or ppa:ondrej/nginx
    PLEASE READ: If you like my work and want to give me a little motivation, please consider donating regularly:
    WARNING: add-apt-repository is broken with non-UTF-8 locales, see for workaround:
    # LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php More info:
    Press [ENTER] to continue or ctrl-c to cancel adding it
    gpg: keybox '/tmp/tmpmbr9q9y5/pubring.gpg' created
    gpg: /tmp/tmpmbr9q9y5/trustdb.gpg: trustdb created
    gpg: key 4F4EA0AAE5267A6C: public key "Launchpad PPA for Ondřej Surý" imported
    gpg: Total number processed: 1
    gpg: imported: 1
    gpg: no valid OpenPGP data found.
    [6:17 pm, 28/04/2020] Helio: cool
    [6:18 pm, 28/04/2020] Helio: sudo apt-get update
    [6:18 pm, 28/04/2020] Nuno Da Elizabeth: njtmendes@penguin:~$ sudo apt-get update
    Hit:1 stable InRelease
    Ign:2 groovy InRelease
    Err:3 groovy Release 404 Not Found [IP: 2001:67c:1560:8008::15 80]
    Get:4 stretch InRelease [6,760 B]
    Hit:5 buster InRelease
    Hit:6 buster/updates InRelease
    Ign:7 buster InRelease
    Hit:8 buster Release
    Get:9 stretch/main amd64 Packages [136 kB]
    Reading package lists... Done
    E: The repository ' groovy Release' does not have a Release file.
    N: Updating from such a repository can't be done securely, and is therefore disabled by default.
    N: See apt-secure(8) manpage for repository creation and user configuration details.

    The output of the `apt update

    njtmendes@penguin:~$ sudo apt update
    Hit:1 stable InRelease
    Hit:2 buster InRelease
    Hit:3 buster/updates InRelease
    Ign:4 buster InRelease
    Hit:5 buster Release
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    All packages are up to date.

It is quite frustrating not have been able to install PHP.

5

1 Answer

It appears you did not successfully add the PPA (additional repository) to your container, as instructed in your first link.

The instructions on that site indicate that you need to know which version of Debian you're running. The quickest way to do that on many Linux distributions is

cat /etc/os-release

Based on your ouptut from apt update I suspect you are running Buster (Debian 9)

To get the additional APT repository, follow these steps

sudo apt update
sudo apt install -y curl wget gnupg2 ca-certificates lsb-release apt-transport-https
wget
sudo apt-key add apt.gpg
echo "deb $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php7.list
sudo apt update

You will then be able to install the version of PHP you want

sudo apt -y install php7.4 php7.4-cli php7.4-common
php -v
PHP 7.4.6 (cli) (built: May 14 2020 10:03:28) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.6, Copyright (c), by Zend Technologies
1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like