Bonfire2 icon indicating copy to clipboard operation
Bonfire2 copied to clipboard

New install not work (it break php spark and default welcome CI page)

Open jinbatsu opened this issue 1 year ago • 7 comments

I have try with fresh install from installation guide which I did: Info: I'm using MAMP in Mac.

which php
# rerturned /Applications/MAMP/bin/php/php8.2.0/bin//php
composer create-project codeigniter4/appstarter my-app

I check the web (from browser) is working as default CI 4 welcome page. and the Environment is production.

Next step:

cd my-app
composer config minimum-stability dev
composer config prefer-stable true

Then:

~/S/p/my-app ❯❯❯ composer require lonnieezell/bonfire:dev-develop
./composer.json has been updated
Running composer update lonnieezell/bonfire
Loading composer repositories with package information
Updating dependencies
Lock file operations: 6 installs, 0 updates, 0 removals
  - Locking codeigniter4/settings (v2.1.1)
  - Locking codeigniter4/shield (dev-develop 22443d0)
  - Locking components/font-awesome (6.2.0)
  - Locking lonnieezell/bonfire (dev-develop 7de4a16)
  - Locking roave/security-advisories (dev-latest d1af114)
  - Locking tatter/alerts (v3.1.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 6 installs, 0 updates, 0 removals
  - Installing codeigniter4/settings (v2.1.1): Extracting archive
  - Installing tatter/alerts (v3.1.0): Extracting archive
  - Installing roave/security-advisories (dev-latest d1af114)
  - Installing components/font-awesome (6.2.0): Extracting archive
  - Installing codeigniter4/shield (dev-develop 22443d0): Extracting archive
  - Installing lonnieezell/bonfire (dev-develop 7de4a16): Extracting archive
Generating optimized autoload files
30 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found
~/S/p/my-app ❯❯❯ 

Next step:

~/S/p/my-app ❯❯❯ php spark bf:install

Fatal error: Uncaught Error: Undefined constant "ENVIRONMENT" in /Users/jinbatsu/Sites/prod/my-app/vendor/codeigniter4/framework/system/Common.php:806
Stack trace:
(...)
~/S/p/my-app ❯❯❯

It break the php spark command. And accesing from browser is not working, it is blank white page. The php spark from CI4 works normally before including bonfire. Additional info: Using PHP 8.2 and intl is loaded.

What is the cause of this?

jinbatsu avatar May 13 '23 18:05 jinbatsu

having the exact same issue

projectwehelp avatar May 14 '23 01:05 projectwehelp

Looks like the current workaround until a fix is released is to add an app/Modules directory. It can be empty.

lonnieezell avatar May 15 '23 03:05 lonnieezell

@jinbatsu @projectwehelp I believe the issue should be fixed now. Can you give it another try and let me know for sure?

lonnieezell avatar May 15 '23 04:05 lonnieezell

confirmed , it's working perfectly now ! Thank you

projectwehelp avatar May 15 '23 04:05 projectwehelp

@lonnieezell , looks like I did not add the proper checks for directory to exist when adding app modules namespaces autodiscovery. Sorry, have to be more careful.

dgvirtual avatar May 15 '23 06:05 dgvirtual

@dgvirtual no worries. The real issue seemed to be using log_message at that point. I didn't trace it all the back but it seems that was being called before ENVIRONMENT constant had been defined and log_message was checking that.

lonnieezell avatar May 15 '23 12:05 lonnieezell

@lonnieezell, OK it works but with error Shield required csrfProtection using session not cookie, so after I change and set like this:

security.csrfProtection = 'session' 
security.tokenRandomize = false
security.tokenName = 'csrf_token_xxx'
security.headerName = 'X-CSRF-TOKEN'
security.cookieName = 'csrf_cookie_xxx'
security.expires = 7200
security.regenerate = true
security.redirect = false
security.samesite = 'Lax'

It works.. Thank you!

jinbatsu avatar May 15 '23 16:05 jinbatsu