I`m using docker image php:7.4.3-apache and I need to install php7.4-cgi. Image is running on Debian 10. I was tried many tutorials but without success.
Etc. this tutorial https://kifarunix.com/install-php-7-4-on-debian-10-debian-9/
When I run installation command then I get following error:
root#eafa0aac715a:/usr/local/bin# apt install php7.4-cgi
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package php7.4-cgi is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'php7.4-cgi' has no installation candidate
I don`t known what I am doing bad.
I was created new clear dockerfile:
FROM php:7.4.3-apache
RUN apt-get -y install apt-transport-https lsb-release ca-certificates curl
RUN wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
RUN sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
RUN apt-get update
RUN apt install php7.4-cgi
Is there somebody who can fix this dockerfile for build?
Did you correctly configure the repositories to be able to install php?. In my case I use the following repository to install the PHP packages:
https://packages.sury.org/php/
How can you configure it in Debian 10?
First install the necessary packages
apt-get -y install apt-transport-https lsb-release ca-certificates curl
Following this, add the GPG key
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
then you create a file with following command inside sources.list.d directory so apt use this repository when updating
sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
and perform an apt-update
apt-get update
after this, you only have to install the package you were trying to install
apt install php7.4-cgi
Related
I have added
packages.sury.org/php
through the script, I got on deb.sury.org
===========================================
#!/bin/sh
# To add this repository please do:
if [ "$(whoami)" != "root" ]; then
SUDO=sudo
fi
${SUDO} apt-get update
${SUDO} apt-get -y install apt-transport-https lsb-release ca-certificates curl
${SUDO} curl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg
${SUDO} sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
${SUDO} apt-get update
===========================================
After running the script is gives an error:
Ign:5 https://packages.sury.org/php kali-rolling InRelease
Err:6 https://packages.sury.org/php kali-rolling Release
404 Not Found [IP: 102.129.144.44 443]
and then continues.
I can't even add the ubuntu repo it gives the same result and I think that one is one is worse.
I also add [trusted=yes] to the php.list file in /etc/apt/sources.list.d/ directory
It gives an even longer error.
Any help is much appreciated
Run as root:
#!/bin/sh
set -e
rm -f /usr/share/keyrings/deb.sury.org-php.gpg
rm -f /etc/apt/sources.list.d/php.list
apt-get update
apt-get -y install apt-transport-https ca-certificates curl
curl -sSLo /etc/apt/trusted.gpg.d/sury-php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ bullseye main" > /etc/apt/sources.list.d/sury-php.list
apt-get update
Officially, the https://packages.sury.org/php/ repo directory only supports the following distribution names: bullseye, buster and stretch. And you have Kali Linux. I replaced the Kali Linux release name with the Debian release name.
I have a web system developed with PHP + MS Sql Server and I do maintenance on Windows environment. But I prefer working in Linux environment, Ubuntu to be more accurate.
But I cannot find a way to install this database driver. I googled but I cannot find any solution. Some tutorials shows how to install in 20.04, 18.04 versions, but even following the steps to the letter, I could no install.
Some tutorials that did not worked.
How to Install the PHP SQLSRV Extension
Linux and macOS Installation Tutorial for the Microsoft Drivers for PHP for SQL Server
Any suggestions?
It seems, at least today, that msodbcsql17 mssql-tools are not available in the Ubuntu 21.04 repos...
$ curl -s https://packages.microsoft.com/config/ubuntu/21.04/prod.list
deb [arch=amd64,armhf,arm64] https://packages.microsoft.com/ubuntu/21.04/prod hirsute main
$ curl -s https://packages.microsoft.com/ubuntu/21.04/prod/dists/hirsute/Contents-amd64.gz | gzip -d | grep -E "msodbcsql|mssql"
# No output.
As a result you'll get errors when you try to install them via apt-get:
$ curl -s https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
$ sudo bash -c "curl -s https://packages.microsoft.com/config/ubuntu/21.04/prod.list > /etc/apt/sources.list.d/mssql-release.list"
$ sudo apt-get update --yes
# ...
$ sudo ACCEPT_EULA=Y apt-get --verbose-versions --yes install msodbcsql17 mssql-tools
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package msodbcsql17
E: Unable to locate package mssql-tools
Update
I have written a bash script to automatically install the appropriate drivers for Ubuntu or Debian: https://github.com/sfinktah/bash/blob/master/add_sqlsrv_repo_combined.sh
I couldn't test support for other Linux vendors, but the capability is there if someone wants to send a PR.
Original Post
21.04 drivers are now available.
Follow the instructions on
https://learn.microsoft.com/en-us/sql/connect/php/installation-tutorial-linux-mac?view=sql-server-ver15 and https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver15#ubuntu17
Or as above:
sudo su
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
#Download appropriate package for the OS version
#Choose only ONE of the following, corresponding to your OS version
# Automatic version selection (does not work for 21.10, but 20.10 or 21.04 are fine)
curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -r -s)/prod.list > /etc/apt/sources.list.d/mssql-release.list
# Manual specification: Ubuntu 21.04
curl https://packages.microsoft.com/config/ubuntu/21.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install -y msodbcsql17
# optional: for bcp and sqlcmd
sudo ACCEPT_EULA=Y apt-get install -y mssql-tools
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc
# optional: for unixODBC development headers
sudo apt-get install -y unixodbc-dev
hi am using a Kali linux Rolling 2020.4 last update and every thing is okay from 2 years until now after i add the PPA of php and update every thing for last update
when i run
sudo apt install php8.0
i get error
E: Unable to locate package php8.0
E: Couldn't find any package by glob 'php8.0'
but i dont know what's the problem
here's the ppa and have php8
http://ppa.launchpad.net/ondrej/php/ubuntu/pool/main/p/php8.0/
and here too
http://ppa.launchpad.net/ondrej/php/ubuntu/
the following command is was i used
sysadmin#debian-10:~$ sudo apt install -y lsb-release apt-transport-https ca-certificates wget
sysadmin#debian-10:~$ sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
sysadmin#debian-10:~$ echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list
Install PHP 8 on Debian
For Debian Buster (10) and Debian Bullseye (11)
With root access:
apt update && apt install -y wget gnupg2 lsb-release
wget https://packages.sury.org/php/apt.gpg && apt-key add apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php.list
apt update && apt install -y php8.1
php -v # Outputs "PHP 8.1.3 ..."
This doesn't works for:
Since June 2022, Debian Stretch (9) (info)
Since June 2020, Debian Jessie (8) (info)
see available distributions
Install PHP 8.1 on Ubuntu
Until 21.04 as described in #NicoHaase's answer
sudo apt update && apt install -y software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update && sudo apt install -y php8.1
php -v # Outputs "PHP 8.1.3 ..."
I have a PHP-CLI Docker image of Debian Buster and would like to install php-imagick package but with command:
Dockerfile:
RUN apt-get install -y php-imagick
I get an error:
Package php-imagick is not available, but is referred to by another
package. This may mean that the package is missing, has been
obsoleted, or is only available from another source
E: Package 'php-imagick' has no installation candidate
running before:
RUN apt-get update -y && apt-get upgrade -y
did not help.
how come there is no package candidate for php-imagick?
how to install and enable imagick extension for this PHP Docker image?
Dockerfile to replicate issue:
FROM php:7.3-buster
RUN apt-get update -y && apt-get upgrade -y
RUN apt-get install -y php-imagick
build command
docker build --tag testimage .
Unless you have a good reason not to, using the packages from https://deb.sury.org/ is probably a good idea. The following appears to work:
FROM debian:buster-slim
USER root
# Get Debian up-to-date
RUN apt-get update -qq \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y git \
mariadb-client wget curl \
ca-certificates lsb-release apt-transport-https gnupg bsdmainutils
RUN echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee -a /etc/apt/sources.list.d/php.list \
&& curl https://packages.sury.org/php/apt.gpg | apt-key add - \
&& apt-get update -qq \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y php7.3 php7.3-common php7.3-cli \
php7.3-mysql php7.3-curl php7.3-xml php7.3-mbstring \
php7.3-intl php7.3-redis php7.3-zip \
php7.3-imagick supervisor
I am running the Wordpress multisite click to deploy on the compute engine.
Operating system
Debian 9.8
Package contents
Apache 2.4.25
Google-Fluentd 1.6.9
MySQL-Client 5.7.26
MySQL-Server 5.7.26
PHP 7.0.33
Stackdriver-Agent 5.5.2
WP-CLI 2.2.0
WordPress 5.1.1
phpMyAdmin 4.6.6
I would like to upgrade PHP to 7.3
You can use a third-party repository to install php7.3
apt-get install ca-certificates apt-transport-https
wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
echo "deb https://packages.sury.org/php/ stretch main" | sudo tee /etc/apt/sources.list.d/php.list
apt-get update
apt-get install php7.3
You may follow this instructions on how to update your php version from 7.0 to 7.3.
For Debian:
$ sudo apt install apt-transport-https lsb-release
$ sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg # Download the signing key
$ sudo sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list' # Add Ondrej's repo to sources list.
$ sudo apt update
$ sudo apt-get install php7.3
To check the current version after the installation:
$ php -v
For Ubuntu:
$ sudo add-apt-repository ppa:ondrej/php # Press enter to confirm.
$ sudo apt-get update
$ sudo apt-get install php7.3
If you encounter the error below during installation, you may execute the command "$ sudo rm /var/lib/dpkg/lock" then try installing the php7.3 again.
E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
Hope this information helps.
After updating your php version, the other thing you should do is:
update MYSQL and get WordPress to to recognize the new version
sudo apt-get update
sudo apt-get install php7.3-mysql
sudo a2enmod php7.3
sudo a2dismod php7.0
sudo systemctl restart apache2
This comprehensive instruction works just fine https://www.jiyuulife.net/update-php-version-for-wordpress-on-debian-9/
In the commands, replace the instruction's PHP version (7.4.5) with the latest release (7.4.11 as of October 2020).
In my case, after the update WordPress alerted me about missing (PHP) extensions that some plugins needed. I added them separately as per the instruction, restarted Apache and everything panned out perfectly fine.
Magic!
Thanks Tang for the great instruction.