[SHLink] API Key for WebUI

My YunoHost server

Hardware: VPS bought online (Contabo)
YunoHost version: 11.1.10 (stable)
I have access to my server : Through SSH | through the webadmin |
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : no
If yes, please explain: N.A.
If your request is related to an app, specify its name and version: shlink v3.4.0~ynh1

Description of my issue

Hi guys, I have setup Shlink on yunohost but am unable to generate an API Key
When I run /var/www/shlink/bin/cli api-key:generate

It returns PHP Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR), expecting ')' in /var/www/shlink/config/container.php on line 16

So I changed PHP CLI to 8.1,
and with the same command I get this


  An exception occurred in the driver: could not find driver


In Exception.php line 28:

  could not find driver


In Driver.php line 39:

  could not find driver


api-key:generate [-m|--name NAME] [-e|--expiration-date EXPIRATION-DATE] [-a|--author-only] [-d|--domain-only DOMAIN-ONLY]

Am I missing something or is the API Key already configured?

1 Like

Hello, and welcome.

Please follow the Support template, and also specify how you “changed PHP CLI to 8.1”.

Then try the next commands and report its output:

cd /var/www/shlink
sudo -u shlink php8.1 bin/cli api-key:generate
1 Like

Hi! Thank you for pointing out, I am new here. I have amended the post accordingly.

For the CLI php I used
sudo update-alternatives --config php

Went with php 8.1 (option 4)


  Selection    Path             Priority   Status
------------------------------------------------------------
  0            /usr/bin/php8.1   81        auto mode
  1            /usr/bin/php7.3   73        manual mode
* 2            /usr/bin/php7.4   74        manual mode
  3            /usr/bin/php8.0   80        manual mode
  4            /usr/bin/php8.1   81        manual mode

I have now reverted the settings.

Running the commands as requested:


root@server:/var/www/shlink# sudo -u shlink php8.1 bin/cli api-key:generate

This is the output:

In ExceptionConverter.php line 83:

  An exception occurred in the driver: could not find driver


In Exception.php line 28:

  could not find driver


In Driver.php line 39:

  could not find driver


api-key:generate [-m|--name NAME] [-e|--expiration-date EXPIRATION-DATE] [-a|--author-only] [-d|--domain-only DOMAIN-ONLY]
1 Like

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