CodeIgniter Forums
PHP PSR Logger Error - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: PHP PSR Logger Error (/showthread.php?tid=91772)



PHP PSR Logger Error - occitan - 10-07-2024

I ran composer update and now I am getting the following error:

My composer has "psr/log": "^3.0",

I tried sudo dnf remove php8.2-psr but it was not found. Tried 8.1 and 8.3 too, I am running PHP 8.3.12.

extension=psr.so isn't in my php.ini file.

What else can I try? I read all the previous threads I can find but have no luck. This worked fine before I ran composer update.

Codeigniter 4.4.4


Code:
AH01071: Got error 'PHP message: PHP Fatal error: Declaration of CodeIgniter\\Log\\Logger::emergency($message, array $context = []): bool must be compatible with Psr\\Log\\LoggerInterface::emergency(Stringable|string $message, array $context = []): void in /var/www/vhosts/domain.com/httpdocs/system/Log/Logger.php on line 159; PHP message: PHP Fatal error: Uncaught Error: Class "CodeIgniter\\Log\\Logger" not found in /var/www/vhosts/domain.com/httpdocs/system/Config/Services.php:401\nStack trace:\n#0 /var/www/vhosts/domain.com/httpdocs/system/Config/BaseService.php(258)



RE: PHP PSR Logger Error - captain-sensible - 10-08-2024

this is my composer.json:

Code:
{
    "name": "codeigniter4/appstarter",
    "description": "CodeIgniter4 starter app",
    "license": "MIT",
    "type": "project",
    "homepage": "https://codeigniter.com",
    "support": {
        "forum": "https://forum.codeigniter.com/",
        "source": "https://github.com/codeigniter4/CodeIgniter4",
        "slack": "https://codeigniterchat.slack.com"
    },
    "require": {
        "php": "^8.1",
        "codeigniter4/framework": "4.5.5",
         "phpmailer/phpmailer": "^6.8"
    },
    "require-dev": {
        "fakerphp/faker": "^1.9",
        "mikey179/vfsstream": "^1.6",
        "phpunit/phpunit": "^10.5.16"
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Config\\": "app/Config/"
        },
        "exclude-from-classmap": [
            "**/Database/Migrations/**"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\Support\\": "tests/_support"
        }
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "scripts": {
        "test": "phpunit"
    }
}

ran :
Code:
[andrew@darkstar ~]$ cd /srv/http/CI4-CMS
[andrew@darkstar CI4-CMS]$ composer update
Loading composer repositories with package information
Updating dependencies
Lock file operations: 0 installs, 2 updates, 0 removals
  - Upgrading nikic/php-parser (v5.2.0 => v5.3.1)
  - Upgrading phpunit/phpunit (10.5.34 => 10.5.36)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 2 updates, 0 removals
  - Downloading nikic/php-parser (v5.3.1)
  - Downloading phpunit/phpunit (10.5.36)
  - Upgrading nikic/php-parser (v5.2.0 => v5.3.1): Extracting archive
  - Upgrading phpunit/phpunit (10.5.34 => 10.5.36): Extracting archive
Generating optimized autoload files
27 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found.
[andrew@darkstar CI4-CMS]$
can you paste your composer.json


RE: PHP PSR Logger Error - kenjis - 10-09-2024

If you want to use psr/log v3, upgrade to CI 4.5.
See https://github.com/codeigniter4/CodeIgniter4/pull/8339


RE: PHP PSR Logger Error - occitan - 10-09-2024

I changed my composer.json to "psr/log": "^2.0", and the error went away, but I feel like this is a bad idea.

(10-09-2024, 05:20 PM)kenjis Wrote: If you want to use psr/log v3, upgrade to CI 4.5.
See https://github.com/codeigniter4/CodeIgniter4/pull/8339

What is the best way to upgrade? Do I just swap out the system folder?



RE: PHP PSR Logger Error - InsiteFX - 10-12-2024

You need to upgrade step by step and yes you will need to backup your app folder and make changes to it also
to get to CodeIgniter v4.5.5