0

I'm running a Google Cloud server running Ubuntu 22.04. It's a typical LAMP stack (PHP is version 8.1.2). Some of the websites on the server are using Laravel 8.

I recently upgraded one of the websites to Laravel 9 and I received the following error:

Class 'Facade\Ignition\IgnitionServiceProvider' not found

From a little bit of research, apparently this is caused by a PHP extension Sodium missing.

If I run php -i | grep sodium using a terminal I get:

PHP Warning:  PHP Startup: Unable to load dynamic library 'sodium' (tried: /usr/lib/php/20210902/sodium (/usr/lib/php/20210902/sodium: cannot open shared object file: No such file or directory), /usr/lib/php/20210902/sodium.so (/usr/lib/php/20210902/sodium.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
sodium
sodium support => enabled
libsodium headers version => 1.0.18
libsodium library version => 1.0.18
PWD => /home/thomasadam83/libsodium-stable
$_SERVER['PWD'] => /home/thomasadam83/libsodium-stable

I tried installing Sodium using:

sudo apt install php-sodium

And received the following response:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package php-sodium

If I run any PHP commands form the terminal, the response starts with:

PHP Warning:  PHP Startup: Unable to load dynamic library 'sodium' (tried: /usr/lib/php/20210902/sodium (/usr/lib/php/20210902/sodium: cannot open shared object file: No such file or directory), /usr/lib/php/20210902/sodium.so (/usr/lib/php/20210902/sodium.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

I can't find any other posts with a similar issue and a working solution.

Any help would be appreciated!

Gerald Schneider
  • 23,274
  • 8
  • 57
  • 89
Adam
  • 3
  • 1
  • 3

1 Answers1

0

In Ubuntu 22.04 the php8 package has sodium support directly compiled into the main package, there is no loadable library.

I assume you uncommented ;extension=sodium in php.ini. That wasn't necessary, sodium was already there. You can try that by commenting the line out again, then run a simple PHP script using a sodium function, for example:

<?php
$result = sodium_compare(452654236423,647382647836);
var_dump($result);

You should see a result, without an error.

$ php test.php
int(-1)

If that is the case your problem is not missing sodium support, it's something else.

Gerald Schneider
  • 23,274
  • 8
  • 57
  • 89
  • Everything you said was accurate! Thanks! I commented out `;extension=sodium` and fixed the original problem another way. – Adam Dec 16 '22 at 12:44