Welcome Guest, Not a member yet? Register   Sign In
Fatal error: Uncaught Error: Call to a member function run() on int
#1

(This post was last modified: 06-12-2022, 12:38 PM by AgBRAT. Edit Reason: Added errors when running composer update )

I updated to CodeIgniter 4.2.0 using Composer and now I get the following error.
Code:
Fatal error: Uncaught Error: Call to a member function run() on int in /Users/nykianderson/Sites/shape_search/public_html/index.php:37 Stack trace: #0 {main} thrown in /Users/nykianderson/Sites/shape_search/public_html/index.php on line 37

I also got these errors after running composer update and I noticed that /usr/local/lib/php/pecl is not the path to the php I've been running:

Code:
nykianderson@Nykis-MacBook-Pro ~ % composer update
PHP Warning:  Failed loading Zend extension 'xdebug' (tried: /usr/local/lib/php/pecl/20210902/xdebug (dlopen(/usr/local/lib/php/pecl/20210902/xdebug, 0x0009): tried: '/usr/local/lib/php/pecl/20210902/xdebug' (no such file)), /usr/local/lib/php/pecl/20210902/xdebug.so (dlopen(/usr/local/lib/php/pecl/20210902/xdebug.so, 0x0009): tried: '/usr/local/lib/php/pecl/20210902/xdebug.so' (no such file))) in Unknown on line 0

Warning: Failed loading Zend extension 'xdebug' (tried: /usr/local/lib/php/pecl/20210902/xdebug (dlopen(/usr/local/lib/php/pecl/20210902/xdebug, 0x0009): tried: '/usr/local/lib/php/pecl/20210902/xdebug' (no such file)), /usr/local/lib/php/pecl/20210902/xdebug.so (dlopen(/usr/local/lib/php/pecl/20210902/xdebug.so, 0x0009): tried: '/usr/local/lib/php/pecl/20210902/xdebug.so' (no such file))) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'curl' (tried: /usr/local/lib/php/pecl/20210902/curl (dlopen(/usr/local/lib/php/pecl/20210902/curl, 0x0009): tried: '/usr/local/lib/php/pecl/20210902/curl' (no such file)), /usr/local/lib/php/pecl/20210902/curl.so (dlopen(/usr/local/lib/php/pecl/20210902/curl.so, 0x0009): tried: '/usr/local/lib/php/pecl/20210902/curl.so' (no such file))) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'curl' (tried: /usr/local/lib/php/pecl/20210902/curl (dlopen(/usr/local/lib/php/pecl/20210902/curl, 0x0009): tried: '/usr/local/lib/php/pecl/20210902/curl' (no such file)), /usr/local/lib/php/pecl/20210902/curl.so (dlopen(/usr/local/lib/php/pecl/20210902/curl.so, 0x0009): tried: '/usr/local/lib/php/pecl/20210902/curl.so' (no such file))) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'gd' (tried: /usr/local/lib/php/pecl/20210902/gd (dlopen(/usr/local/lib/php/pecl/20210902/gd, 0x0009): tried: '/usr/local/lib/php/pecl/20210902/gd' (no such file)), /usr/local/lib/php/pecl/20210902/gd.so (dlopen(/usr/local/lib/php/pecl/20210902/gd.so, 0x0009): tried: '/usr/local/lib/php/pecl/20210902/gd.so' (no such file))) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'gd' (tried: /usr/local/lib/php/pecl/20210902/gd (dlopen(/usr/local/lib/php/pecl/20210902/gd, 0x0009): tried: '/usr/local/lib/php/pecl/20210902/gd' (no such file)), /usr/local/lib/php/pecl/20210902/gd.so (dlopen(/usr/local/lib/php/pecl/20210902/gd.so, 0x0009): tried: '/usr/local/lib/php/pecl/20210902/gd.so' (no such file))) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'intl' (tried: /usr/local/lib/php/pecl/20210902/intl (dlopen(/usr/local/lib/php/pecl/20210902/intl, 0x0009): tried: '/usr/local/lib/php/pecl/20210902/intl' (no such file)), /usr/local/lib/php/pecl/20210902/intl.so (dlopen(/usr/local/lib/php/pecl/20210902/intl.so, 0x0009): tried: '/usr/local/lib/php/pecl/20210902/intl.so' (no such file))) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'intl' (tried: /usr/local/lib/php/pecl/20210902/intl (dlopen(/usr/local/lib/php/pecl/20210902/intl, 0x0009): tried: '/usr/local/lib/php/pecl/20210902/intl' (no such file)), /usr/local/lib/php/pecl/20210902/intl.so (dlopen(/usr/local/lib/php/pecl/20210902/intl.so, 0x0009): tried: '/usr/local/lib/php/pecl/20210902/intl.so' (no such file))) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'mbstring' (tried: /usr/local/lib/php/pecl/20210902/mbstring (dlopen(/usr/local/lib/php/pecl/20210902/mbstring, 0x0009): tried: '/usr/local/lib/php/pecl/20210902/mbstring' (no such file)), /usr/local/lib/php/pecl/20210902/mbstring.so (dlopen(/usr/local/lib/php/pecl/20210902/mbstring.so, 0x0009): tried: '/usr/local/lib/php/pecl/20210902/mbstring.so' (no such file))) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'mbstring' (tried: /usr/local/lib/php/pecl/20210902/mbstring (dlopen(/usr/local/lib/php/pecl/20210902/mbstring, 0x0009): tried: '/usr/local/lib/php/pecl/20210902/mbstring' (no such file)), /usr/local/lib/php/pecl/20210902/mbstring.so (dlopen(/usr/local/lib/php/pecl/20210902/mbstring.so, 0x0009): tried: '/usr/local/lib/php/pecl/20210902/mbstring.so' (no such file))) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'mysqli' (tried: /usr/local/lib/php/pecl/20210902/mysqli (dlopen(/usr/local/lib/php/pecl/20210902/mysqli, 0x0009): tried: '/usr/local/lib/php/pecl/20210902/mysqli' (no such file)), /usr/local/lib/php/pecl/20210902/mysqli.so (dlopen(/usr/local/lib/php/pecl/20210902/mysqli.so, 0x0009): tried: '/usr/local/lib/php/pecl/20210902/mysqli.so' (no such file))) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'mysqli' (tried: /usr/local/lib/php/pecl/20210902/mysqli (dlopen(/usr/local/lib/php/pecl/20210902/mysqli, 0x0009): tried: '/usr/local/lib/php/pecl/20210902/mysqli' (no such file)), /usr/local/lib/php/pecl/20210902/mysqli.so (dlopen(/usr/local/lib/php/pecl/20210902/mysqli.so, 0x0009): tried: '/usr/local/lib/php/pecl/20210902/mysqli.so' (no such file))) in Unknown on line 0
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating autoload files
1 package you are using is looking for funding.
Use the `composer fund` command to find out more!
nykianderson@Nykis-MacBook-Pro ~ %

Here is my index.php

PHP Code:
<?php

// Path to the front controller (this file)
define('FCPATH'__DIR__ DIRECTORY_SEPARATOR);

/*
 *---------------------------------------------------------------
 * BOOTSTRAP THE APPLICATION
 *---------------------------------------------------------------
 * This process sets up the path constants, loads and registers
 * our autoloader, along with Composer's, loads our constants
 * and fires up an environment-specific bootstrapping.
 */

// Ensure the current directory is pointing to the front controller's directory
chdir(__DIR__);

// Load our paths config file
// This is the line that might need to be changed, depending on your folder structure.
$pathsConfig FCPATH '../app/Config/Paths.php';
// ^^^ Change this if you move your application folder
require realpath($pathsConfig) ?: $pathsConfig;

$paths = new Config\Paths();

// Location of the framework bootstrap file.
$bootstrap rtrim($paths->systemDirectory'\\/ ') . DIRECTORY_SEPARATOR 'bootstrap.php';
$app      = require realpath($bootstrap) ?: $bootstrap;

/*
 *---------------------------------------------------------------
 * LAUNCH THE APPLICATION
 *---------------------------------------------------------------
 * Now that everything is setup, it's time to actually fire
 * up the engines and make this app do its thang.
 */
$app->run(); 

SOLVED: Did a fresh install of CodeIgniter and everything seems to be working as before. Not sure what the issue was though.
Reply
#2

You need to remember that configs, public/index.php entry point and spark can change.
https://codeigniter.com/user_guide/chang...or-changes
Reply




Theme © iAndrew 2016 - Forum software by © MyBB