Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tools:ci4 [2022/05/16 15:59] – [Hello world] darron | tools:ci4 [2022/08/19 12:24] (current) – [Resources] darron | ||
---|---|---|---|
Line 8: | Line 8: | ||
===Install Apache & PHP=== | ===Install Apache & PHP=== | ||
+ | |||
+ | Update | ||
< | < | ||
apt update | apt update | ||
apt full-upgrade | apt full-upgrade | ||
- | apt install apache2 php php-cli php-mbstring php-intl php-curl | + | </ |
+ | |||
+ | Install | ||
+ | |||
+ | < | ||
+ | apt install apache2 php php-cli php-mbstring php-intl php-curl | ||
+ | </ | ||
+ | |||
+ | 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, | ||
</ | </ | ||
Line 22: | Line 54: | ||
mkdir -p / | mkdir -p / | ||
cd / | cd / | ||
- | wget https:// | + | wget https:// |
- | unzip ci4.zip | + | unzip ci4.2.4.zip |
- | mv codeigniter4-CodeIgniter4-202f41a | + | mv codeigniter4-CodeIgniter4-* hostname.kewl.org |
cd hostname.kewl.org | cd hostname.kewl.org | ||
chown www-data: | chown www-data: | ||
</ | </ | ||
+ | Warning: 4.1 would auto-detect routes but this is not the case with 4.2. | ||
===Configure apache=== | ===Configure apache=== | ||
Line 42: | Line 75: | ||
RewriteCond %{REQUEST_FILENAME} !-f | RewriteCond %{REQUEST_FILENAME} !-f | ||
RewriteCond %{REQUEST_FILENAME} !-d | RewriteCond %{REQUEST_FILENAME} !-d | ||
- | RewriteRule .* /index.php/$1 [L] | + | RewriteRule .* / |
< | < | ||
Line 70: | Line 103: | ||
=== Hello world==== | === Hello world==== | ||
- | Create controller. | + | ==Controller== |
< | < | ||
Line 91: | Line 124: | ||
</ | </ | ||
- | Create | + | ==Index |
< | < | ||
- | vi app/Views/Hello.php | + | vi app/Views/Index.php |
</ | </ | ||
Line 101: | Line 134: | ||
<html lang=" | <html lang=" | ||
< | < | ||
- | < | + | < |
</ | </ | ||
< | < | ||
- | <p>Hello World</p> | + | <!--Content start--> |
+ | <? | ||
+ | < | ||
</ | </ | ||
Line 111: | Line 146: | ||
</ | </ | ||
- | Visit URL | + | ==Controller view== |
+ | |||
+ | < | ||
+ | vi app/ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | <?php | ||
+ | $this-> | ||
+ | $this-> | ||
+ | phpinfo(); | ||
+ | $this-> | ||
+ | ?> | ||
+ | </ | ||
+ | |||
+ | ==Route== | ||
+ | |||
+ | vi app/ | ||
+ | < | ||
+ | $routes-> | ||
+ | </ | ||
+ | |||
+ | ==URL== | ||
< | < | ||
Line 117: | Line 174: | ||
</ | </ | ||
+ | ===Resources=== | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// |