How to install PHP memcached extension?

I tried:

  - run: sudo apt-get update
  - run: sudo apt-get install software-properties-common
  - run: sudo add-apt-repository ppa:ondrej/php -y
  - run: sudo apt-get update

But this results in:

#!/bin/bash -eo pipefail
sudo add-apt-repository ppa:ondrej/php -y
gpg: keybox '/tmp/tmp4w7h9556/pubring.gpg' created
gpg: /tmp/tmp4w7h9556/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.

And:

#!/bin/bash -eo pipefail
sudo apt-get update
Hit:1 http://security.debian.org/debian-security stretch/updates InRelease

Ign:2 http://deb.debian.org/debian stretch InRelease

Hit:3 http://deb.debian.org/debian stretch-updates InRelease

Hit:4 http://deb.debian.org/debian stretch Release

Ign:5 http://ppa.launchpad.net/ondrej/php/ubuntu cosmic InRelease

Ign:6 http://ppa.launchpad.net/ondrej/php/ubuntu cosmic Release

0% [Release.gpg gpgv 118 kB]Ign:8 http://ppa.launchpad.net/ondrej/php/ubuntu cosmic/main all Packages

Ign:9 http://ppa.launchpad.net/ondrej/php/ubuntu cosmic/main amd64 Packages

Ign:8 http://ppa.launchpad.net/ondrej/php/ubuntu cosmic/main all Packages

17% [Working]Ign:9 http://ppa.launchpad.net/ondrej/php/ubuntu cosmic/main amd64 Packages

Ign:8 http://ppa.launchpad.net/ondrej/php/ubuntu cosmic/main all Packages

Ign:9 http://ppa.launchpad.net/ondrej/php/ubuntu cosmic/main amd64 Packages

Ign:8 http://ppa.launchpad.net/ondrej/php/ubuntu cosmic/main all Packages

17% [Working]Ign:9 http://ppa.launchpad.net/ondrej/php/ubuntu cosmic/main amd64 Packages

Ign:8 http://ppa.launchpad.net/ondrej/php/ubuntu cosmic/main all Packages

Ign:9 http://ppa.launchpad.net/ondrej/php/ubuntu cosmic/main amd64 Packages

17% [Working]Ign:8 http://ppa.launchpad.net/ondrej/php/ubuntu cosmic/main all Packages

Err:9 http://ppa.launchpad.net/ondrej/php/ubuntu cosmic/main amd64 Packages
  404  Not Found

Reading package lists... 1%
Reading package lists... Done

W: The repository 'http://ppa.launchpad.net/ondrej/php/ubuntu cosmic Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch http://ppa.launchpad.net/ondrej/php/ubuntu/dists/cosmic/main/binary-amd64/Packages  404  Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.
Exited with code 100

This is a big warning, and should be heeded.

I wonder if this is the reason why you get the authentication error?

What Docker base image are you using?

(Aside: these problems are not CI specific, so it may be helpful to your research and debugging to treat this problem as if you experienced it on your local machine. Do search for it over on Stack Overflow as well.)

@halfer, thanks for the speedy response.

    docker:
      # specify the version you desire here
      - image: circleci/php:7.1-browsers
      - image: circleci/mysql:5.6

The problem seems to be specific to CI as I do not have problems with adding the repo on my local Ubuntu. This forum is the last resort for me to find an answer. I definitely searched in other places including Stack Overflow.

It is very frustrating to spend so much time on setting up the testing environment and not being able to install a usual PHP extension. :frowning:

You are probably running a different version of Ubuntu locally. 404 errors in repos are typical of:

  • the distribution is no longer supported by the maintainers
  • the third-party repo you are wanting to import is too old (in other words, the distribution is too new for the third-party)

So, this is a possibility, but I currently still doubt it. CircleCI is really just a Docker container, so there is not really much CircleCI stuff to get in the way.

Not so. Thankfully, the internet is a big place!

If I were trying to fix this, I would try the following options:

  • Investigate the errors as I outlined in my first post
  • Experiment with changing the base image in case it is too old/new (as previously noted)
  • Find a Docker image on Docker Hub containing PHP and this extension already
  • Compile the extension yourself inside every build
  • Create a new Docker build yourself, compile the extension, push the image to a registry and then use that as your CircleCI build container

Don’t say that. The servers might hear you, and then they’d really get grumpy. :slightly_smiling_face:

I am obviously not an expert in docker. Let’s say I want to use Ubuntu 16.04. Is this is the right place to find the image - Docker?

What should be the value of - image: in my configuration file?

From this search I found this post. which gives one possible answer as php:7.0-alpine, and I’d guess php:7.1-alpine too.

That’s not Debian-based though, it’s BusyBox, so you’d need to determine if your build will still run in it.

This question has answers that look like it they might run on an Ubuntu-based image (probably what you are using now). So they are worth a go first.

You do not need to be an expert in it. The tutorials in the documentation are excellent - set aside a couple of hours to try them. That learning will make your CircleCI journey much easier, and Docker is a great skill to have anyway.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.