I just updated my Codeigniter 4 site from 4.1 to 4.2 using composer and am now getting the following server error in the Apache error log:
PHP Fatal error: Uncaught Error: Call to a member function run() on int in /var/www/vhosts/site/public/index.php
I'm thinking a file has been changed or CI 4.2 requires a missing PHP lib, but I've looked at the .env, /public/index.php and /app/config/App.php file and they haven't changed.
Any help would be much appreciated!
Codeigniter v4.2.0 changes
index.php
and spark
files have significant changes in v4.2.0.
To upgrade, you must merge the new versions.
If you are using the standard CI4 index.php (you've not modified it):
cd <root-dir-of-CI-project>
cp vendor/codeigniter4/framework/public/index.php public/index.php
And similarly for standard CI4 spark
(you've not modified it):
cd <root-dir-of-CI-project>
cp vendor/codeigniter4/framework/spark .
ELSE merge the new versions of index.php
and spark
with your current versions.
https://codeigniter4.github.io/userguide/installation/upgrade_420.html#index-php-and-spark