Ubuntu Trusty has no PECL support under PHP7

While Ubuntu Precise (12.04) has PECL installed with PHP 7, it’s missing on Ubuntu Trusty (14.04).

I spend more then few hours trying to set it up but couldnt.

In my case it’s needed for ext-redis & ext-intl (hopefully nothing more but composer is now just complaining on those 2)

@msvrtan Sorry for the slow turnaround (I’m working in JST).

Could you add the following to your circle.yml?

dependencies:
  override:
    - sudo apt-get update && sudo apt-get install php-pear

If it’s just the matter of using pecl, the above command should install pecl for you. If that doesn’t work for you, please let me know. I’m not very good at PHP but I’ll figure out.

Thanks for your patience!

I have the same problem with PHP7 (no pecl). The above wouldn’t work as CircleCI has it’s own PHP7 build, that is not based on aptitude. So doing apt-get install php-pear installs pecl for php5, together with php5 and many unnecessary php5 packages. If you then use that pecl to install a package, those packages of course will be incompatible and unavailable to the PHP7 interpreter.

@ddinchev Thanks for the explanation. I’ve re-created PHP 7.0.3 package with pear enabled. Could you add the following lines to your circle.yml?

machine:
  php:
    version: 7.0.3

dependencies:
  override:
    - curl -s https://packagecloud.io/install/repositories/circleci/trusty/script.deb.sh | sudo bash
    - sudo apt-get install circleci-php-7.0.3=2
    - phpenv rehash

I could get pecl running in this build. If the package works, I can pre-install it on our Trusty build image so that you don’t need to download everytime.

Let me know how it goes.

Better solution would be to be able select what php-extionsions to install, just as puphpet or phansible do.

Thanks, I’m testing it now, will get back soon.

It’s available (in sudo I need to go with full path!) but when I want to install apcu, it breaks compiling

You can see it here https://circleci.com/gh/msvrtan/devboard/1683#ssh-info (check installing apcu, same thing happend with intl when I run it manually from ssh)

Hmm, I’m not very sure about PHP extension but maybe you need to use a PHP7 branch as mentioned here ?

Thats for building predis from source.

But it might point towards issue that you havent linked all the libraries correctly and it’s using PHP 5 version (which is a default on system)

I got APCU issue solved, It was trying to load old version (4.x which doesnt support PHP 7).

With a lot of googling, I found out that PECL doesnt support intl for PHP7, it’s now supported only as direct php extension.

Can you compile PHP7 with --enable-intl ?

@msvrtan Sorry for the slow turnaround.

I just built php with --enable-intl locally, but I’m not sure how to make sure if the option is really enabled. Do you know a way to confirm this?

@msvrtan actually maybe you can try :slight_smile:

You can install with the newest one circleci-php-7.0.3=3 with the following.

machine:
  php:
    version: 7.0.3

dependencies:
  override:
    - curl -s https://packagecloud.io/install/repositories/circleci/trusty/script.deb.sh | sudo bash
    - sudo apt-get install circleci-php-7.0.3=3

There is no version 3 :frowning:

ubuntu@box1204:~$ sudo apt-cache policy circleci-php-7.0.3
circleci-php-7.0.3:
Installed: 1
Candidate: 2
Version table:
2 0
500 packagecloud.io/circleci/trusty/ubuntu/ trusty/main amd64 Packages
*** 1 0
500 packagecloud.io/circleci/trusty/ubuntu/ trusty/main amd64 Packages
100 /var/lib/dpkg/status

Oops, uploaded to wrong place. Can you try again now?

WORKS!!

Tnx kimh!

When could we expect this to become default 7.0.3 version?

Also, if I have some more suggestions (adding redis client, setting up fpm config correctly and etc.) should I open new issue?

Do you have any idea when this image will be default one? Do you usually push it with whole container update or can it be pushed earlier?

@msvrtan

I’m sorry for the slow response.

When could we expect this to become default 7.0.3 version?

I’ll ship a new build image next week and pecl will be available without doing the manual installation.

Also, if I have some more suggestions (adding redis client, setting up fpm config correctly and etc.) should I open new issue?

Separate issues would be awesome so that other customers can add their +1.

Thanks!

Thanks kimh!

Can you please ping me here when new image is up?

OK, I’ll remind you once we’ve shipped the new image.