Welcome Guest, Not a member yet? Register   Sign In
Unable CodeIgniter 4 Foundations Code Samples - Lonnie Ezell Book
#1

Hi 

I am unable to run the CodeIgniter 4 Foundations Code Samples by Lonnie Ezell.

https://github.com/lonnieezell/ci4-foundations

   Here are the errors thrown when I run php spark serve:
I tried to use the rest of the assets in the root folder above the project-01, project-2 folders but to no avail.

Code:
C:\xampp\htdocs\project1328>php spark serve
PHP Warning:  require(C:\xampp\htdocs\project1328\app\Config/../../../vendor/codeigniter4/framework/system/bootstrap.php): failed to open stream: No such file or directory in C:\xampp\htdocs\project1328\spark on line 44

Warning: require(C:\xampp\htdocs\project1328\app\Config/../../../vendor/codeigniter4/framework/system/bootstrap.php): failed to open stream: No such file or directory in C:\xampp\htdocs\project1328\spark on line 44
PHP Fatal error:  require(): Failed opening required 'C:\xampp\htdocs\project1328\app\Config/../../../vendor/codeigniter4/framework/system/bootstrap.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\project1328\spark on line 44

Fatal error: require(): Failed opening required 'C:\xampp\htdocs\project1328\app\Config/../../../vendor/codeigniter4/framework/system/bootstrap.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\project1328\spark on line 44
Reply
#2

(This post was last modified: 03-28-2021, 08:55 PM by InsiteFX.)

This has to be your settings with Composer etc; Because I manually install it and it runs just fine.

Sounds like a Composer autoload problem.

If you change the folder of the public folder to something else, you need to edit spark and tell
it where the folder is.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

(03-28-2021, 08:54 PM)InsiteFX Wrote: This has to be your settings with Composer etc; Because I manually install it and it runs just fine.

Sounds like a Composer autoload problem.

If you change the folder of the public folder to something else, you need to edit spark and tell
it where the folder is.
Hi InsiteFX:

1. I downloaded the zip file. Unzipped the contents under c:\xampp\htdocs.

2. I cd to C:\xampp\htdocs\ci4-foundations-master\project-01

3. I typed php spark serve

I am still getting the same errors. I have tried the other projects also.

I am not messing with Composer for this project. Simply download, unzip, cd to project folder and run php spark serve.

Please let me know how you got yours to work.

Best regards

AHirsi
Reply
#4

I also use xampp but I use vhosts, I just created a new project called ci4foundations and set the root path to
that. I setup my localhost in windows hosts like found.local but you can use localhost.

I only use spark for configuring things etc;
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#5

You will need to use Composer to install the CodeIgniter 4 framework for the example projects; the repository doesn't include it.
Reply
#6

(This post was last modified: 01-30-2023, 04:59 PM by danger89.)

In my case I tried to upgrade my CI setup, and all files I didn't adapt I thought I could easily copy them to retrieve the latest file. Like:
Code:
cp vendor/codeigniter4/framework/app/Config/Constants.php ./app/Config/

However, I did the same for the app/Config/Paths.php
file, but that resulted in your error message as well.

Bottom-line: don't try to replace the Paths.php file from upstream. And the $systemDirectory variable in Paths.php should look like this:

PHP Code:
public $systemDirectory __DIR__ '/../../vendor/codeigniter4/framework/system'
Ps. Sorry to reply on an older thread, but this one showed up high in Google results.
Reply
#7

It seem the sample code needs PHP 7.3.

Code:
$ git clone [email protected]:lonnieezell/ci4-foundations.git
$ cd ci4-foundations/
$ composer install
$ cd project-01/
$ php spark serve

CodeIgniter v4.1.2 Command Line Tool - Server Time: 2023-01-30 18:44:52 UTC-06:00

CodeIgniter development server started on http://localhost:8080
Press Control-C to stop.

Worked with PHP 7.3.33.
Reply
#8

@kenjis has it right. I believe the biggest missing step, though, was that it required composer-based install to get the dependencies, like the framework itself, loaded.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB