Just ran composer update
, upgrading to CodeIgniter v4.4 Now Codeigniter does not work, the log shows the error:
PHP message: PHP Fatal error: Uncaught Error: Undefined constant "CodeIgniter\ENVIRONMENT"
Upgrade to CodeIgniter 4.4
The following files received significant changes and you must merge the updated versions with your application:
If you have not changed index.php or spark, just copy the new versions of these files from the v4.4 framework. Otherwise, merge the new versions with your current files.
cp vendor/codeigniter4/framework/public/index.php public/index.php
cp vendor/codeigniter4/framework/spark spark
After fixing the above, you may still have to update some Config files. Check the following Config changes-:
Uncaught ErrorException: Undefined property: Config\App::$allowedHostnames in /home/dev/src/php/providr/vendor/codeigniter4/framework/system/HTTP/SiteURIFactory.php:246
App/Config/App.php
Check there is a $allowedHostnames
property in the App class. If you want to accept multiple Hostnames, set this property to your hostnames.
public array $allowedHostnames = [];
The property $proxyIPs must be an array. If you don’t use proxy servers, it must be
public array $proxyIPs = [];
app/Config/Routing.php Routing.php is a new Config file which holds settings that used to be read from Routes.php.
Hopefully CodeIgniter will now fire up. But also check the following files which have changes: app/Config/Cookie.php app/Config/Security.php app/Config/Session.php
For full details of all v4.4 changes see CI4 docs - upgrade to v4.4