Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jinbatsu opened this issue May 13, 2023 · 7 comments
Open

Comments

@jinbatsu
Copy link

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?

@projectwehelp
Copy link

having the exact same issue

@lonnieezell
Copy link
Owner

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

@lonnieezell
Copy link
Owner

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

@projectwehelp
Copy link

confirmed , it's working perfectly now ! Thank you

@dgvirtual
Copy link
Contributor

@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.

@lonnieezell
Copy link
Owner

@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.

@jinbatsu
Copy link
Author

@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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants