-
Notifications
You must be signed in to change notification settings - Fork 645
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
[4.x]: "/runtime doesn't exist or isn't writable by PHP. Please fix that." after DDEV-based 3->4 upgrade #14177
Comments
It looks like your By default on new Craft projects, |
Ok, that wasn't the (full) solution itself, but it set me on the right path. I'll document it here for future reference: There's no In any case, I created that file, ensured it has 755 permissions, but it didn't make any difference. Then I looked into the <?php
/**
* Craft web bootstrap file
*/
// Set path constants
define('CRAFT_BASE_PATH', dirname(__DIR__));
define('CRAFT_VENDOR_PATH', CRAFT_BASE_PATH.'/vendor');
// Load Composer's autoloader
require_once CRAFT_VENDOR_PATH.'/autoload.php';
// Load dotenv?
if (file_exists(CRAFT_BASE_PATH.'/.env')) {
(new Dotenv\Dotenv(CRAFT_BASE_PATH))->load();
}
define('CRAFT_STORAGE_PATH', getenv('STORAGE_PATH'));
// Load and run Craft
define('CRAFT_ENVIRONMENT', getenv('ENVIRONMENT') ?: 'production');
$app = require CRAFT_VENDOR_PATH.'/craftcms/cms/bootstrap/web.php';
$app->run(); So now I'm unsure which file should have which code; obviously the above When I also update the
That led me to noticing that the version number in Basically, for every one of these commands... @php craft install/check && php craft clear-caches/compiled-classes --interactive=0 || exit 0
@php craft install/check && php craft clear-caches/compiled-templates --interactive=0 || exit 0
@php craft install/check && php craft clear-caches/data --interactive=0 || exit 0
@php craft install/check && php craft clear-caches/temp-files --interactive=0 || exit 0
@php craft install/check && php craft invalidate-tags/all --interactive=0 || return 0
@php craft install/check && php craft up --interactive=0 || exit 0 ...it spit out this pair of errors: PHP Fatal error: Uncaught TypeError: Dotenv\Dotenv::__construct(): Argument #1 ($store) must be of type Dotenv\Store\StoreInterface, string given, called in /var/www/html/craft on line 16 and defined in /var/www/html/vendor/vlucas/phpdotenv/src/Dotenv.php:60
Stack trace:
#0 /var/www/html/craft(16): Dotenv\Dotenv->__construct('/var/www/html')
#1 {main}
thrown in /var/www/html/vendor/vlucas/phpdotenv/src/Dotenv.php on line 60
Fatal error: Uncaught TypeError: Dotenv\Dotenv::__construct(): Argument #1 ($store) must be of type Dotenv\Store\StoreInterface, string given, called in /var/www/html/craft on line 16 and defined in /var/www/html/vendor/vlucas/phpdotenv/src/Dotenv.php:60
Stack trace:
#0 /var/www/html/craft(16): Dotenv\Dotenv->__construct('/var/www/html')
#1 {main}
thrown in /var/www/html/vendor/vlucas/phpdotenv/src/Dotenv.php on line 60 That said, the site is now functional (🥳), however subsequent runs of both |
Glad you got it sorted!
We added However we do have a section under “Optional Steps” in the Craft 4 upgrade guide, nudging you to check the starter project and maybe update your project based on it. The Dotenv errors you’re getting are because you’re using an older version of |
I think perhaps you missed the part (I know, I give too much information sometimes, sorry) where I got those errors after updating Dotenv to 5.4.0...? |
The code to initialise Dotenv has changed since version
With version You can always check your code against the I hope this helps! |
...ahh, I had missed that the extensionless * Why is it extensionless, anyway? |
Glad you got it sorted! You can read about the |
phpdotenv to
|
What happened?
Description
I'm trying to upgrade a client's Craft 3.x site to 4.x, first locally using DDEV. Once I complete the upgrade process according to the Upgrade docs, if I try to go to either the frontend or backend of the local site, I get a barebones/unstyled error: "/runtime doesn't exist or isn't writable by PHP. Please fix that.":

I've checked the permissions of

storage/runtime/
as seen here:(All the directories shown there are owned by
[myName] [myName]
)There were some odd messages after the supposedly-successful migration process:
Not sure if those have anything to do with anything.
Steps to reproduce
Expected behavior
I'd expect to be able to access the site and/or CP.
Actual behavior
I get the above error message instead.
Craft CMS version
4.5.3.0 (was 3.9.10)
PHP version
8.1
Operating system and version
Windows 11 + WSL2 + DDEV
Database type and version
MariaDB 10.4
Image driver and version
No response
Installed plugins and versions
The text was updated successfully, but these errors were encountered: