Gadget apps use php language, help to install


I’m creating a gadget to use with qemu / kvm for Ubuntu Core 20, and I need to use two programs… And one uses PHP installed on the system to run, and I’m having difficulty with how to have php when creating the image .

My gadget:

The program is phoronix-test-suite, it is running for instance, but when called on the system with $ pc.phoronix-test-suite

it returns: PHP must be installed for the Phoronix Test Suite The PHP command-line package is commonly called php-cli, php7-cli, php8-cli, or php. For more information visit:

In .yarn I use these required packages in stage-packages, but it doesn’t seem to make a difference, isn’t these build steps definitively install on the image to be used?

And how could I correctly install the PHP language on the system to run the program?

(if there is any error in the .yarn you can also comment, tks)

you really dont want to do this from the gadget but instead package the test suite (and all its dependencies) as a daemon/service app snap … then use an entry in your model assertion to make your app snap be installed by default in the image …

1 Like

Thanks for the reply and sorry for my ignorance, but I didn’t understand the complete process of instead package the test suite, more specifically for their dependencies, if you can expand on this part in explication, I would appreciate it.

About the second stage, In my model I’m using the gadget reference by snap,

..."snaps": [
           "name": "pc",
           "type": "gadget",
           "default-channel": "20/stable",
           "id": "<id>"

with this already being installed in the image, should there be a greater insertion than that in this second part of the process?

you create a snap named something like phoronix-snap upload it, then add an entry for phoronix-snap to the “snaps”: list you quoted in your model assertion … when building your image, ubuntu-image will make sure this snap is pre-installed in your image …

… when building this application snap make sure the php interpreter is properly included in it and make sure you have a wrapper (if needed) to set the correct environment variables so the test suite finds the php interpreter …

1 Like

Ok, I’ll try it here,


Hello, again, about that yet, I created a directory for realization…

But I’m having difficulties, the dependencies I think are ok, but I’m lost in the organization of files, I’m using the program’s install-sh script, passing the installation destination ($DESTDIR to /usr), and it’s happening.

When use with --debug, I can call the program correct, but with the .snap installation, using the command in the app, it can’t access, it doesn’t seem to be the correct binary, I can’t find what I’m wronging this process, if you can guide me, thank you.


Figures of the override-build process and when the snap is installed and called:

the phoronix-test-suite script seems to hardcode /usr/share somewhere.

either make it use the correct location poining to the snap directory where that dir resides through patching the script (or, if it allows, through configuration or an environment variable) or use a layout to re-map the snap directory to /usr/share …