6

When entering artisan commands in laravel- ubuntu 20.04 it shows following error

PHP Warning: Cannot load module "http" because required module "raphf" is not loaded in Unknown on line 0

PHP version 8.1.1, Laravel 8 , Ubuntu 20.04

screen shot

karel
  • 114,770
hemil
  • 163

2 Answers2

10

Installing the package solved the issue for me:

$ sudo apt install php-raphf
Jakke
  • 1,016
  • 1
  • 12
  • 25
  • php-raphf is already the newest version (2.0.1+1.1.2-13+ubuntu20.04.1+deb.sury.org+10). – ahmednawazbutt Aug 12 '22 at 13:36
  • @ahmednawazbutt Try to install with specific your php version. For example, if you use php8.1, try sudo apt install php8.1-raphf. To check your php version, you can run command, php --version. – ibnɘꟻ Mar 18 '23 at 04:21
3

Some more details. This occurs when you switch PHP versions - it happened to me when I switched to PHP 8.

If you check for your installed version of php-raphf with

apt list php-raphf

You will notice that you (most likely) have it. However, if you run

$ sudo apt install php-raphf

as described above, Ubuntu will install a PHP-dependent version:

The following NEW packages will be installed:
  php-raphf php8.1-raphf
  • 1
    Yes If you have multiple php versions installed, like when using php-fpm, you'll have to specify the version number. Usually you can check in '''/etc/php''' or '''/use/bin/''' wich php versions you have installed and you can switch with '''sudo update-alternatives'''' for php-cli and separately in your webserver config (nginx, Apache, etc) – Jakke Mar 19 '23 at 12:49