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

[5.x]: Not Supported: Changes to the project config are not possible while in read-only mode. #16891

Open
AmsalSugihan opened this issue Mar 14, 2025 · 5 comments
Labels

Comments

@AmsalSugihan
Copy link

What happened?

Description

php craft update all

i've set my allowAdminChanges to true, run composer update and do php craft up on my local. But still get this error.
im trying to update craft from 5.5.9 to 5.6.11

Not Supported: Changes to the project config are not possible while in read-only mode.

Migration: craft\migrations\m241125_122914_add_viewUsers_permission

Output:

Exception: Changes to the project config are not possible while in read-only mode. (/var/www/html/vendor/craftcms/cms/src/services/ProjectConfig.php:554)
#0 /var/www/html/vendor/craftcms/cms/src/services/ProjectConfig.php(526): craft\services\ProjectConfig->_setInternal()
#1 /var/www/html/vendor/craftcms/cms/src/migrations/m241125_122914_add_viewUsers_permission.php(49): craft\services\ProjectConfig->set()
#2 /var/www/html/vendor/craftcms/cms/src/db/Migration.php(50): craft\migrations\m241125_122914_add_viewUsers_permission->safeUp()
#3 /var/www/html/vendor/craftcms/cms/src/db/MigrationManager.php(233): craft\db\Migration->up()
#4 /var/www/html/vendor/craftcms/cms/src/db/MigrationManager.php(149): craft\db\MigrationManager->migrateUp()
#5 /var/www/html/vendor/craftcms/cms/src/services/Updates.php(245): craft\db\MigrationManager->up()
#6 /var/www/html/vendor/craftcms/cms/src/controllers/BaseUpdaterController.php(499): craft\services\Updates->runMigrations()
#7 /var/www/html/vendor/craftcms/cms/src/controllers/UpdaterController.php(213): craft\controllers\BaseUpdaterController->runMigrations()
#8 [internal function]: craft\controllers\UpdaterController->actionMigrate()
#9 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()
#10 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams()
#11 /var/www/html/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction()
#12 /var/www/html/vendor/craftcms/cms/src/web/Application.php(361): yii\base\Module->runAction()
#13 /var/www/html/vendor/craftcms/cms/src/web/Application.php(753): craft\web\Application->runAction()
#14 /var/www/html/vendor/craftcms/cms/src/web/Application.php(254): craft\web\Application->_processUpdateLogic()
#15 /var/www/html/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest()
#16 /var/www/html/web/index.php(12): yii\base\Application->run()
#17 {main}

Steps to reproduce

  1. php craft update all
  2. composer update
  3. php craft up

Expected behavior

Actual behavior

Craft CMS version

5.6.11

PHP version

8.2

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

@brandonkelly
Copy link
Member

Check your .env file. Do you define a CRAFT_ALLOW_ADMIN_CHANGES variable in there?

@AmsalSugihan
Copy link
Author

i actually already set it on general.php settings

$config = GeneralConfig::create()
    ->timezone('Asia/Singapore')
    ->defaultWeekStartDay(1)
    ->omitScriptNameInUrls()
    ->preloadSingles()
    ->preventUserEnumeration()
    ->cpTrigger(null)
    ->headlessMode()
    ->disallowRobots()
    ->baseCpUrl(App::env('BASE_CP_URL'))
    ->aliases([
        '@webroot' => dirname(__DIR__) . '/web',
        '@primaryUrl' => App::env('PRIMARY_SITE_URL'),
        '@previewBaseUrl' => '@primaryUrl/api/preview',
    ])
    ->devMode(true)
    ->allowAdminChanges(true)
;

@brandonkelly
Copy link
Member

Right, but if you have a CRAFT_ALLOW_ADMIN_CHANGES environment variable set, that will take precedence. Did you check?

@AmsalSugihan
Copy link
Author

Thanks @brandonkelly , when i use ->allowAdminChanges(true) i don't set the CRAFT_ALLOW_ADMIN_CHANGES on my env, but when i put the CRAFT_ALLOW_ADMIN_CHANGES , now its work.

@brandonkelly
Copy link
Member

Try commenting out your change, and then going to Utilities → PHP Info within your control panel, and searching for CRAFT_ALLOW_ADMIN_CHANGES. Are you seeing any references to it there?

If so, then CRAFT_ALLOW_ADMIN_CHANGES is in fact getting set somewhere – just maybe not in your .env file.

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

No branches or pull requests

2 participants