Reputation: 12407
I need to install some packages to prepare the workspace for a project in the Debian 9 OS runs in a VB. I have the instruction:
----------------------------------------------------------------------
The following Debian 8 packages are required to run [X-Product]:
sudo apt-get install exim4 ntp pwgen curl php5-dev php-pear pkg-config nmap libzmq3 libzmq3-dev libapache2-mod-php5 apache2 percona-server-server-5.6 php5-cli php5-mysql php5-curl php5-intl daemontools-run oracle-java8-installer ant ruby-compass libtool-bin
----------------------------------------------------------------------
When I run the command, I get the following terminal stack,
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package php5-cli 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
Package php5-mysql 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
Package php5-curl 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
Package libapache2-mod-php5 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: Unable to locate package php5-dev
E: Unable to locate package libzmq3
E: Package 'libapache2-mod-php5' has no installation candidate
E: Package 'php5-cli' has no installation candidate
E: Package 'php5-mysql' has no installation candidate
E: Package 'php5-curl' has no installation candidate
E: Unable to locate package php5-intl
I did some research on the internet, did the following at next,
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
It doesn't help me at all. What do I need to fix this? I have very little knowledge about Debian if you ask
Note: I followed the instructions in the answer provided, the issue is still not solved like I cant see the php version
When I run the command of
sudo apt-get install php5.6
It prints in the terminal,
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'php5.6-json' for regex 'php5.6'
Note, selecting 'php5.6-common' for regex 'php5.6'
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
To look for the PHP
version,
sudo php -v
It prints in the terminal,
sudo: php: command not found
More info like if I run it
sudo apt-get install php5-dev
I get error
E: Unable to locate package php5-dev
But, the command
sudo apt-get install php-dev
is successful
The command
dpkg -l | grep php| awk '{print $2}' |tr "\n" " "
returns value,
Is that mean I hvae php7 installed and that blocks other operations?
dh-php php-cli php-common php-dev php-gd php-pear php-xml php7.0-cli php7.0-common php7.0-dev php7.0-gd php7.0-json php7.0-opcache php7.0-readline php7.0-xml pkg-php-tools
Upvotes: 5
Views: 27125
Reputation: 2260
I had this same problem, attempting to follow the instructions on php's website.
Turns out, on Debian 9, it was quite simple: just drop the version from the package names.
# apt-get install php-common libapache2-mod-php php-cli Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: libapache2-mod-php7.0 php7.0-cli php7.0-common php7.0-json php7.0-opcache php7.0-readline Suggested packages: php-pear The following NEW packages will be installed: libapache2-mod-php libapache2-mod-php7.0 php-cli php-common php7.0-cli php7.0-common php7.0-json php7.0-opcache php7.0-readline
Upvotes: -2
Reputation: 4625
The package libapache2-mod-php5.6
, php5-dev
, php5-mysql
,php5-curl
can be installed only on debian Wheezy (7) , Jessie (8) or Sid . Also the ondrej/php repository does not provide those package for debian Stretch it is only provide the php5.6
package.
The command sudo apt-get install php-dev
will install the development module for PHP7 :
dh-php libssl-dev libssl-doc php7.1-cli php7.1-common php7.1-dev php7.1-json
php7.1-opcache php7.1-readline pkg-php-tools shtool xml2
Upvotes: 3
Reputation: 1166
Open the terminal and run the following command:
apt-get install apt-transport-https lsb-release ca-certificates
Get the gpg key:
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
Add the new repository to your sources:
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list
Install PHP5.6
apt-get update
apt-get install php5.6
Update
Workaround for line echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list
:
Run this, and take note of the output:
lsb_release -sc
Open up /etc/apt/sources.list.d/php.list
in your editor of choice and append this to the bottom:
deb https://packages.sury.org/php/ OUTPUT_FROM_LSC_COMMAND main
Upvotes: 4
Reputation: 12105
Debian 9 does not contain PHP 5.x (see https://wiki.debian.org/PHP). To install it from the ppa, install the package php5.6
and accordingly named other packages (like libapache2-mod-php5.6
instead of libapache2-mod-php5
)
Upvotes: 3