1.Installation
1.1 download and install Codeigniter
webpage
1.2 configuration
main configuration
- Develop your app inside the app folder.
- The public folder will be your public-facing document root.
- Do not change anything inside the system folder!
CI4 has been already an application before and can be nested into the htdocs of XAMPP.
And there are TWO values necessarily modified.
- app/Config/App.php => baseURL=?
- app/Config/Database.php =>some info:username,password=?
Then the configuration of server:
apache2/conf/httpd.conf
LoadModule rewrite_module modules/mod_rewrite.so
//make it uncommented
htaccess
<Directory "/opt/lamp/apache2/htdocs">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
if localhost/ci_project doesn’t work ,the solution below will be applied.
apache/phpini
(append)
extension = intl;
1.3 remove /public from URL
- copy these two files : .htaccess && index.html in public folder to the project root folder.
- modify the value of $pathsConfig to “FCPATH . ‘/app/Config/Paths.php’”;
URL without public folder can work!
2.composer installation
2.1 download XAMPP
2.2 download composer
a dependency manager of php
2.2.1 install composer like normal software
2.2.2 download codeigniter and create new project directory
command:
composer create-project codeigniter4/appstarter project-name
2.3 configuration
-
2.3.1 A subtle problem
-
A problem may be emerged due to a lack of internation implement;
solution=> delete ; from ;extension=intl in /php/php.in -
2.3.2 env file
(official description )
CodeIgniter makes it simple and painless to set Environment Variables by using a “dotenv” file. The term comes from the file name, which starts with a dot before the text “env”.
CodeIgniter expects .env to be at the root of your project alongside the system and app directories. There is a template file distributed with CodeIgniter that’s located at the project root named env (Notice there’s no dot (.) at the start?). It has a large collection of variables your project might use that have been assigned empty, dummy, or default values. You can use this file as a starting place for your application by either renaming the template to .env, or by making a copy of it named .env.
(Attention: add . before env)
There indeed are three important points emphasised here.
-
CI_ENVIRONMENT = development
(the original value is production) -
app.baseURL = ‘http://localhost/’
-
mysql parameters group
writable
some modifiable files like session ,cache or files stored in the server.vendor
public
it’s like a entry of codeigniter ???set up running environment and launch the default index webpage.
Reference:
1.[extremely recommend]
Alex Lancer —youtube