====CodeIgniter 4==== Simple demo of CI4 framework. ===Environment=== Devuan Chimaera 4.0 ===Install Apache & PHP=== Update apt update apt full-upgrade Install apt install apache2 php php-cli php-mbstring php-intl php-curl php-json php-mysqlnd php-xml PHP version php --version PHP 7.4.28 (cli) (built: Feb 17 2022 16:17:19) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.28, Copyright (c), by Zend Technologies ===Install MySQL=== Install MariaDB fork of MySQL. apt-get install default-mysql-server default-mysql-client MySQL version mysql --version mysql Ver 15.1 Distrib 10.5.15-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper ===Install CI4=== Download package and unzip into htdocs. mkdir -p /var/www/htdocs cd /var/www/htdocs wget https://api.github.com/repos/codeigniter4/CodeIgniter4/zipball/v4.2.4 -O ci4.2.4.zip unzip ci4.2.4.zip mv codeigniter4-CodeIgniter4-* hostname.kewl.org cd hostname.kewl.org chown www-data:www-data writable Warning: 4.1 would auto-detect routes but this is not the case with 4.2. ===Configure apache=== DocumentRoot "/var/www/htdocs/hostname.kewl.org/public" ServerName hostname.kewl.org ServerAdmin root Header append X-FRAME-OPTIONS "SAMEORIGIN" RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule .* /var/www/htdocs/hostname.kewl.org/public/index.php [L] Options None AllowOverride None CustomLog /var/log/apache2/hostname.kewl.org/access.log combined ErrorLog /var/log/apache2/hostname.kewl.org/error.log ===Configure CI4=== Change baseURL and indexPage in app config. vi app/Config/App.php Change logging threshold if required. vi app/config/Logger.php === Hello world==== ==Controller== vi app/Controllers/Hello.php ==Index view== vi app/Views/Index.php Index renderSection("Content")?> ==Controller view== vi app/Views/Hello.php extend("Index"); $this->section("Content"); phpinfo(); $this->endSection(); ?> ==Route== vi app/Config/Routes.php $routes->get('/Hello', 'Hello::index'); ==URL== http://hostname.kewl.org/Hello ===Resources=== [[https://codeigniter4.github.io/CodeIgniter4/outgoing/view_layouts.html|View layouts]] [[https://codeigniter.com/user_guide/incoming/routing.html|Routing]] [[https://onlinewebtutorblog.com/codeigniter-4/what-is-codeigniter/|Basic overview]]