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

Bug: Fatal error: Uncaught Error: Undefined constant "ENVIRONMENT" in /var/www/html/MyApp/system/Common.php:777 #8945

Closed
DaveInga opened this issue Jun 10, 2024 · 1 comment

Comments

@DaveInga
Copy link

DaveInga commented Jun 10, 2024

PHP Version

8.2

CodeIgniter4 Version

4.4.8

CodeIgniter4 Installation Method

Manual (zip or tar.gz)

Which operating systems have you tested for this bug?

macOS, Linux

Which server did you use?

apache

Database

MariaDB 10.6

What happened?

When running docker compose, I have an entrypoint script that calls "php spark migrate" to migrate tables to MariaDB. The error that appears in my terminal output from "docker compose up --build" is "Could not open input file: spark".

Steps to Reproduce

To debug the error, I entered the container with "docker run -it --entrypoint /bin/bash " and changed directory to /var/www/html (where the spark shell script has been copied to) and verified that the permissions were runnable (-rwxr-xr-x 1 www-data www-data 2815 Jun 10 00:42 spark). I then ran "php spark" and got the error.

root@297c44e85927:/var/www/html# php spark
This "system/bootstrap.php" is no longer used. If you are seeing this error message,
the upgrade is not complete. Please refer to the upgrade guide and complete the upgrade.
See https://codeigniter4.github.io/userguide/installation/upgrade_450.html

Fatal error: Uncaught Error: Undefined constant "ENVIRONMENT" in /var/www/html/Tooths/system/Common.php:777
Stack trace:
#0 /var/www/html/Tooths/system/Debug/Exceptions.php(458): log_message('warning', '[DEPRECATED] {m...', Array)
#1 /var/www/html/Tooths/system/Debug/Exceptions.php(216): CodeIgniter\Debug\Exceptions->handleDeprecationError('Creation of dyn...', '/var/www/html/T...', 218)
#2 /var/www/html/Tooths/app/Config/App.php(218): CodeIgniter\Debug\Exceptions->errorHandler(8192, 'Creation of dyn...', '/var/www/html/T...', 218)
#3 /var/www/html/Tooths/system/Config/Factories.php(235): Config\App->__construct()
#4 /var/www/html/Tooths/system/Config/Factories.php(169): CodeIgniter\Config\Factories::createInstance('config', 'Config\\App', Array)
#5 /var/www/html/Tooths/system/Config/Factories.php(188): CodeIgniter\Config\Factories::__callStatic('config', Array)
#6 /var/www/html/Tooths/system/Common.php(207): CodeIgniter\Config\Factories::get('config', 'Config\\App')
#7 /var/www/html/Tooths/system/Config/Services.php(564): config('Config\\App')
#8 /var/www/html/Tooths/system/Config/BaseService.php(320): CodeIgniter\Config\Services::incomingrequest(NULL, false)
#9 /var/www/html/Tooths/system/Config/Services.php(526): CodeIgniter\Config\BaseService::__callStatic('incomingrequest', Array)
#10 /var/www/html/Tooths/system/Config/BaseService.php(311): CodeIgniter\Config\Services::request(NULL, false)
#11 /var/www/html/Tooths/system/Config/BaseService.php(250): CodeIgniter\Config\BaseService::__callStatic('request', Array)
#12 /var/www/html/Tooths/system/Config/Services.php(522): CodeIgniter\Config\BaseService::getSharedInstance('request', NULL)
#13 /var/www/html/Tooths/system/Config/BaseService.php(320): CodeIgniter\Config\Services::request()
#14 /var/www/html/Tooths/system/Debug/Exceptions.php(129): CodeIgniter\Config\BaseService::__callStatic('request', Array)
#15 [internal function]: CodeIgniter\Debug\Exceptions->exceptionHandler(Object(Error))
#16 {main}
  thrown in /var/www/html/Tooths/system/Common.php on line 777

Fatal error: Uncaught Error: Undefined constant "ENVIRONMENT" in /var/www/html/Tooths/system/Common.php:777
Stack trace:
#0 /var/www/html/Tooths/system/Debug/Exceptions.php(458): log_message('warning', '[DEPRECATED] {m...', Array)
#1 /var/www/html/Tooths/system/Debug/Exceptions.php(216): CodeIgniter\Debug\Exceptions->handleDeprecationError('Creation of dyn...', '/var/www/html/T...', 218)
#2 /var/www/html/Tooths/app/Config/App.php(218): CodeIgniter\Debug\Exceptions->errorHandler(8192, 'Creation of dyn...', '/var/www/html/T...', 218)
#3 /var/www/html/Tooths/system/Config/Factories.php(235): Config\App->__construct()
#4 /var/www/html/Tooths/system/Config/Factories.php(169): CodeIgniter\Config\Factories::createInstance('config', 'Config\\App', Array)
#5 /var/www/html/Tooths/system/Config/Factories.php(188): CodeIgniter\Config\Factories::__callStatic('config', Array)
#6 /var/www/html/Tooths/system/Common.php(207): CodeIgniter\Config\Factories::get('config', 'Config\\App')
#7 /var/www/html/Tooths/system/Config/Services.php(564): config('Config\\App')
#8 /var/www/html/Tooths/system/Config/BaseService.php(311): CodeIgniter\Config\Services::incomingrequest(NULL, false)
#9 /var/www/html/Tooths/system/Config/Services.php(526): CodeIgniter\Config\BaseService::__callStatic('incomingrequest', Array)
#10 /var/www/html/Tooths/system/Config/BaseService.php(311): CodeIgniter\Config\Services::request(NULL, false)
#11 /var/www/html/Tooths/system/Config/BaseService.php(250): CodeIgniter\Config\BaseService::__callStatic('request', Array)
#12 /var/www/html/Tooths/system/Config/Services.php(522): CodeIgniter\Config\BaseService::getSharedInstance('request', NULL)
#13 /var/www/html/Tooths/system/Config/BaseService.php(311): CodeIgniter\Config\Services::request()
#14 /var/www/html/Tooths/system/Debug/Exceptions.php(129): CodeIgniter\Config\BaseService::__callStatic('request', Array)
#15 /var/www/html/Tooths/system/Debug/Exceptions.php(252): CodeIgniter\Debug\Exceptions->exceptionHandler(Object(ErrorException))
#16 [internal function]: CodeIgniter\Debug\Exceptions->shutdownHandler()
#17 {main}
  thrown in /var/www/html/Tooths/system/Common.php on line 777

Expected Output

I expected spark to run my migrations to the database defined by my environment variables. I use different environment variables for local/staging/production databases.

Anything else?

No response

@DaveInga DaveInga added the bug Verified issues on the current code behavior or pull requests that will fix them label Jun 10, 2024
@kenjis kenjis removed the bug Verified issues on the current code behavior or pull requests that will fix them label Jun 10, 2024
@kenjis
Copy link
Member

kenjis commented Jun 10, 2024

This is not a bug.
Please refer to the upgrade guide and complete the upgrade.

This "system/bootstrap.php" is no longer used. If you are seeing this error message,
the upgrade is not complete. Please refer to the upgrade guide and complete the upgrade.
See https://codeigniter4.github.io/userguide/installation/upgrade_450.html

We use GitHub issues to track BUGS and to track approved DEVELOPMENT work packages. We use our forum to provide SUPPORT and to discuss FEATURE REQUESTS.

@kenjis kenjis closed this as completed Jun 10, 2024
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

2 participants