How do I install PECL Yaml, apcu, and xdebug for php 7.0 on Ubuntu 16.04?

I set up a new linode (Linode 2048) with Ubuntu 16.04, Nginx 1.10.0, and php 7.0.4. I set up a basic Grav installation with the admin plugin and all seems to be working well. I believe that I have all the required php extensions installed:

==> dpkg -l | grep php
ii php-common 1:35ubuntu6 all Common files for PHP packages
ii php7.0-cli 7.0.4-7ubuntu2 amd64 command-line interpreter for the PHP scripting language
ii php7.0-common 7.0.4-7ubuntu2 amd64 documentation, examples and common module for PHP
ii php7.0-curl 7.0.4-7ubuntu2 amd64 CURL module for PHP
ii php7.0-fpm 7.0.4-7ubuntu2 amd64 server-side, HTML-embedded scripting language (FPM-CGI binary)
ii php7.0-gd 7.0.4-7ubuntu2 amd64 GD module for PHP
ii php7.0-json 7.0.4-7ubuntu2 amd64 JSON module for PHP
ii php7.0-mbstring 7.0.4-7ubuntu2 amd64 MBSTRING module for PHP
ii php7.0-opcache 7.0.4-7ubuntu2 amd64 Zend OpCache module for PHP
ii php7.0-readline 7.0.4-7ubuntu2 amd64 readline module for PHP
ii php7.0-xml 7.0.4-7ubuntu2 amd64 DOM, SimpleXML, WDDX, XML, and XSL module for PHP
ii php7.0-zip 7.0.4-7ubuntu2 amd64 Zip module for PHP

I am not sure how to install some of the optional modules for php 7.0?

(I did install opcache.)

When I do “apt-cache search php7.0-”, I do not see any of these modules listed.

Are these optional modules still recommended for Ubuntu 16.04/php 7.0? Has anyone installed them for this environment and can point me to the procedures?

I am really new to Web Development (although, I have lots of experience with Linux), but I am trying to learn! Since I am new, I wanted to start with the newer environment, Ubuntu 16.04, php 7.0, … I want to start off with a solid installation as a foundation to build on. I have been able to set up this environment, including the optional modules listed, on my Mac, using Homebrew (Using Andy’s instructions). I would also like to get the same environment working on Ubuntu 16.04 if that still makes sense.

Thanks a lot for any pointers or suggestions.

you can find packages with:

$ sudo apt-cache search php7.0

Should be something like:

$ sudo apt-get install php7.0-xcache php7.0-yaml php7.0-apcu

I do plan on writing an Ubuntu 16.04/PHP 7.0 version of the VPS installation docs as there are several changes required due to new package versions and new file locations.

Thanks, I did search the apt package list, but these packages do not exist:

george@linode1: /home/george
==> sudo apt-cache search php7.0 | egrep “yaml|apcu|xcache”

george@linode1: /home/george

After spending some time on Google, this is what I have found for yaml (I replaced php5-dev with php7.0-dev)

sudo apt-get install php7.0-dev php-pear libyaml-dev
sudo pecl install yaml

It downloaded the 1.2 version of yaml and tried to build it, but the build failed.

In file included from /tmp/pear/temp/yaml/yaml.c:35:0:
/tmp/pear/temp/yaml/php_yaml.h:56:40: fatal error: ext/standard/php_smart_str.h: No such file or directory
compilation terminated.

The procedure that I found was for php 5.x, so may be that’s why it failed. I will dig deeper, and see if I can get it working.

Yes, it will be nice when you get a chance to update the VPS installation docs.


Ubuntu 16.04 is very new to me too. I just got things running on a test VPS a couple of days ago. I need to go back and redo it and take notes this time. Wasn’t too bad, but a little different than previous.

Also PHP7.0 is new to Ubuntu so they probably just don’t have all the packages available yet. Took a while to get some of these in Homebrew also, so it’s to be expected.

Yes, I know that it’s all new. I guess since I am just really getting started, I wanted to start with the latest. Also, I tried:

$ sudo pecl install yaml-beta

This time, the build worked:

Build process completed successfully
Installing '/usr/lib/php/20151012/’
install ok: channel://
configuration option “php_ini” is not set to php.ini location
You should add “” to php.ini

FYI, I found this procedure, which worked for me, for installing the yaml beta version for php7.0:

sudo pecl install yaml-beta sudo sh -c “echo > /etc/php/7.0/mods-available/yaml.ini”
sudo ln -s /etc/php/7.0/mods-available/yaml.ini /etc/php/7.0/fpm/conf.d/20-yaml.ini sudo ln -s /etc/php/7.0/mods-available/yaml.ini /etc/php/7.0/cli/conf.d/20-yaml.ini
$ sudo service php7.0-fpm restart

I also found a similar procedure for apau, which DID NOT work. It does not build correctly:

sudo pecl install apcu sudo sh -c “echo > /etc/php/7.0/mods-available/apcu.ini”
sudo ln -s /etc/php/7.0/mods-available/apcu.ini /etc/php/7.0/fpm/conf.d/20-apcu.ini sudo ln -s /etc/php/7.0/mods-available/apcu.ini /etc/php/7.0/cli/conf.d/20-apcu.ini
$ sudo service php7.0-fpm restart

I found both procedures at:

They were for Ubuntu 14.04 with, I believe, a pre-release version of php7.0.

Anyway, I just wanted to share what I have learned so far in case it might be helpful to someone.

I did some more research and learned that APCu beta version 5.1.0 is compatible with php7.0 ( so:

==> sudo pecl install apcu-5.1.0


Build process completed successfully
Installing '/usr/lib/php/20151012/’
Installing '/usr/include/php/20151012/ext/apcu/apc_sma_api.h’
Installing '/usr/include/php/20151012/ext/apcu/apc_cache_api.h’
Installing '/usr/include/php/20151012/ext/apcu/apc_pool_api.h’
Installing '/usr/include/php/20151012/ext/apcu/apc_lock_api.h’
Installing '/usr/include/php/20151012/ext/apcu/apc.h’
Installing '/usr/include/php/20151012/ext/apcu/apc_serializer.h’
Installing '/usr/include/php/20151012/ext/apcu/apc_api.h’
install ok: channel://
configuration option “php_ini” is not set to php.ini location
You should add “” to php.ini

and I was able to install it via the procedure that I previously noted.

So I now have the beta versions of yaml and apcu installed on my Mac OS, Ubuntu 16.04 VM, but, being new, I do not know how well it’s working.

My Grav 1.10.0 install Configuration Info shows:

APCu Support

LibYAML Support
Module Version
LibYAML Version

Oops, there is a pecl apcu stable version, apcu-5.1.3.

Have you found any speed improvements with APCu in PHP 7.0? In my testing with Grav at least, there is no performance benefit over files. This is a bit strange as it makes a huge difference in PHP 5.x

I just google’ed a website to test the page load speed, Can you recommend a better resource? Anyway, I ran some very quick tests. I may have seen a slight improvement with apcu loaded, but not much. This was a 1 page Grav site. I have been focused on getting a clean Ubuntu 16.04, php 7.0 installation working. And, then I will get back to developing my site, using Grav. I think that I am about there.

Again, keep in mind, I am new at this.

And, btw, I learned that APCU can be installed with just:

sudo apt install php-apcu

This is the latest, 5.1.3 version, which is suppose to be compatible with php 7.0.

Check to make sure you have apcu loaded by searching for it in phpinfo page.

Yes, I had restarted php-fpm and verified on the php info page that it was running.

Thanks guys! This thread helped A LOT!