Welcome Guest, Not a member yet? Register   Sign In
404 - File Not Found Codeigniter 4
#1

Hello there, I'm Crevitz. I'm quite new when it comes to codeigniter 4 and installed it using composer. When I run the spark and access via localhost:8080/myproject, this "404 File Not Found. Sorry! Cannot seem to find the page you were looking for" page.

I thought I did a mistake while installing codeigniter so I redo the installation also I recheck my php version which turns out to be 7.2.10
I also create htaccess in my project folder but it makes no difference.

I'm in lost, would somebody kindly help me?

PS: Is it gonna be different if you use --no-dev or just plain appstarter myproject?
Reply
#2

(This post was last modified: 10-20-2020, 05:19 AM by captain-sensible.)

this is one painless way to get started, which maybe needs tweaking for Windows (im on linux)

open a terminal
conform where we are :
Code:
bash-5.0$ pwd
/home/andrew


move context of terminal to Desktop:

Code:
cd Desktop

install an appstarter directory on Desktop , with no extra (unit test etc)

Code:
bash-5.0$ composer  create-project codeigniter4/appstarter --no-dev

(i can just use "composer" because i set up so that composer evokes composer.phar


you can do that and make it global using terminal :
say composer.phar is on your Desktop use as root command below or add "sudo"

Code:
mv composer.phar /usr/local/bin/composer

refer to : https://getcomposer.org/

basically it will be something like :

Code:
php composer.phar <command>

when composer has successfully downloaded; you will have following directory structure:

Code:
appstarter
├── README.md
├── app
├── builds
├── composer.json
├── composer.lock
├── env
├── license.txt
├── phpunit.xml.dist
├── public
├── spark
├── tests
├── vendor
└── writable


lets fire it up

confirm where terminal is:
Code:
bash-5.0$ pwd
/home/andrew/Desktop

now lets move inside appstarter directory:

cd appstarter

fire up :

[CODE]
bash-5.0$ php spark serve


CodeIgniter CLI Tool - Version 4.0.4 - Server-Time: 2020-10-20 05:52:55am

CodeIgniter development server started on http://localhost:8080
Press Control-C to stop.
[Tue Oct 20 11:52:55 2020] PHP 7.4.1 Development Server (http://localhost:8080) started

Couple of things @Crevitz if you follow above using spark server, you will find Welocome to Codeigniter page at : http://localhost:8080

if you have codeigniter in Apache xampp you need to point "listening" so that it uses public folder.

Codeigniter already has a .htaccess in public . The only time i needed to touch it was when going from http to https on live server.

The difference between using --no-dev is that if you don't use it you get a load of extra stuff.

if you do not use it and find actually you don't need it you can always get rid of it using :

Code:
composer update --no-dev


the url to see the home page is just :

http://localhost:8080

no need for http://localhost:8080/project

check directory structure


The other thing i was going to mention is this: You might say fine , having that on my Desktop but i can not really do any development can i, since i will be using a database. So i will have to move it to Apache or Xampp. Not quite true . MySql Maria etc need a database daemon/server what ever you want to call it , but sqlite3 does not. sqlite3 is serverless and is just a file. I put mine in the writable directory. If you get sqlitebrowser you can view fields data in a basic gui and even create a databse, table. sqlite3 has a capacity of 281 terabytes so it should be more than enough .

But MySQl is secure and sqlite3 doesn't use passwords ! well take it from me Wordpress uses MySQL and stores admin user name and passwords in a table called users. A lot of Wordpress sites are vulnerable nether-the-less.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB