chexbox
Posts: 28
Joined: Thu Apr 28, 2016 11:31 pm
Location: US

Installing PHP

Tue May 22, 2018 9:50 pm

I am unable to install php.
I tried using this article: https://www.raspberrypi.org/documentati ... /apache.md

Code: Select all

sudo apt-get update # worked
sudo apt-get upgrade # also worked
sudo apt-get dist-upgrade # worked as well
sudo apt-get 
Here's where things get interesting:

Code: Select all

sudo apt-get install php libapache2-mod-php -y
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package php
E: Unable to locate package libapache2-mod-php
What am I doing wrong?

User avatar
scruss
Posts: 1800
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Installing PHP

Wed May 23, 2018 1:23 am

If you just

Code: Select all

sudo apt install libapache2-mod-php
it should pull in php7 as a dependency.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

leiptrstormr
Posts: 60
Joined: Mon May 18, 2015 12:33 pm

Re: Installing PHP

Wed May 23, 2018 2:54 am

Code: Select all

apt-cache search php
This will spit back quite a few packages.

Code: Select all

apt-cache search php | less
Slightly more manageable.

Code: Select all

sudo apt-get install php7.0 
Should be what you're looking for.

User avatar
rpdom
Posts: 12810
Joined: Sun May 06, 2012 5:17 am
Location: Ankh-Morpork

Re: Installing PHP

Wed May 23, 2018 4:38 am

Run apt-get update again before doing the apt-get install command. This extra step is needed just once due to something that was changed in a recent upgrade.

chexbox
Posts: 28
Joined: Thu Apr 28, 2016 11:31 pm
Location: US

Re: Installing PHP

Wed May 23, 2018 12:52 pm

I'll try these and reply if anything worked.
Edit: They didn't

sbeland
Posts: 3
Joined: Sat Oct 21, 2017 2:11 pm

Re: Installing PHP

Wed May 23, 2018 7:17 pm

why you don't use something light and simple:

sudo apt-get install php-fpm

User avatar
scruss
Posts: 1800
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Installing PHP

Thu May 24, 2018 2:11 pm

chexbox wrote:
Wed May 23, 2018 12:52 pm
I'll try these and reply if anything worked.
Edit: They didn't
please provide:
  1. the contents of the file /etc/os-release
  2. any error messages you received.
Otherwise, "They didn't" isn't enough to go on.

This from an up-to-date Zero running Raspbian Stretch, running all the apt commands from that article:

Code: Select all

$ sudo apt-get install apache2 php libapache2-mod-php 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  apache2-bin apache2-data apache2-utils libapache2-mod-php7.0 libapr1
  libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap php-common php7.0
  php7.0-cli php7.0-common php7.0-json php7.0-opcache php7.0-readline
Suggested packages:
  apache2-doc apache2-suexec-pristine | apache2-suexec-custom php-pear
The following NEW packages will be installed:
  apache2 apache2-bin apache2-data apache2-utils libapache2-mod-php
  libapache2-mod-php7.0 libapr1 libaprutil1 libaprutil1-dbd-sqlite3
  libaprutil1-ldap php php-common php7.0 php7.0-cli php7.0-common php7.0-json
  php7.0-opcache php7.0-readline
0 upgraded, 18 newly installed, 0 to remove and 0 not upgraded.
Need to get 4,559 kB of archives.
After this operation, 17.0 MB of additional disk space will be used.
Do you want to continue? [Y/n] 
If you don't get this, you're either running an old OS or there's something broken with your system/network.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

Return to “General discussion”

Who is online

Users browsing this forum: No registered users and 34 guests