# Unable to get a local version of a site working - 500 error

**URL:** https://discourse.roots.io/t/unable-to-get-a-local-version-of-a-site-working-500-error/27118
**Category:** sage
**Created:** 2024-05-07T12:16:47Z
**Posts:** 9

## Post 1 by @SimonOliver — 2024-05-07T12:16:47Z

Hi,

I’ve inherited a Sage 9 / Bedrock project from a dev that no longer works at my company and I’m struggling to get it running locally in a MAMP environment.

Here’s what I have so far:

I have the files for the local environment, these all appear to be ok. I can run composer install from the root of the project and in the theme folder, and I can also run Yarn && Yarn build with no errors coming up.

I’ve checked the .env file and that appears to be setup correctly. There is also a database and the .env is pointing at this.

I’ve checked my hosts file and this is also setup correctly.

I’ve added the local site to my vhosts file.

When I try and navigate to the site (es-streetfurniture.test, for example) I just get -

" This page isn’t working  
**es-streetfurniture.test** is currently unable to handle this request.  
HTTP ERROR 500"

I’m able to view other sites that I have setup for local through MAMP.

Can anybody suggest steps for me to diagnose or fix this?

Update: I found the following error in the php\_error.log

PHP Fatal error: Uncaught Error: Call to undefined method Dotenv\Dotenv::createUnsafeImmutable()

Thanks!

---

## Post 2 by @evance — 2024-05-07T15:03:24Z

> [@SimonOliver](#):
>
> PHP Fatal error: Uncaught Error: Call to undefined method Dotenv\Dotenv::createUnsafeImmutable()

Sounds like you haven’t installed `vlucas/phpdotenv` just yet…?

Make sure to follow the [Sage 9 docs for existing projects](https://github.com/roots/docs/blob/35c61e28b018be08c182629856dff2773d92c9eb/docs/sage/9.x/existing-projects.md) and report back with specific error logs / output if the problem should persist.

---

## Post 3 by @SimonOliver — 2024-05-07T15:54:37Z

Hi,

I’ve taken a look at the linkyou supplied and the first thing is that in my package.json there is no Sage version number. In fact, the only thing in there is the following -

{  
“dependencies”: {  
“font-awesome”: “^4.7.0”  
}  
}

There doesn’t appear to be a bower.json file that would indicate it is a Sage 8 project.

Running composer install results in the following error -

“Your lock file does not contain a compatible set of packages. Please run composer update.”

Running composer update gives me the following error -

"Your requirements could not be resolved to an installable set of packages.

Problem 1  
- illuminate/support[v5.6.0, …, v5.6.39] require php ^7.1.3 → your php version (8.2.0) does not satisfy that requirement.  
- Root composer.json requires illuminate/support 5.6.\* → satisfiable by illuminate/support[v5.6.0, …, v5.6.39]."

Looking at the package.json of other projects I think I’m missing all of the requirements for the project.

---

## Post 4 by @evance — 2024-05-08T07:29:33Z

> [@SimonOliver](#):
>
> and the first thing is that in my package.json there is no Sage version number

You can also easily check the `CHANGELOG.md` in your theme folder which will give you the Sage version.

> [@SimonOliver](#):
>
> illuminate/support[v5.6.0, …, v5.6.39] require php ^7.1.3 → your php version (8.2.0) does not satisfy that requirement.

You’d need to [update the composer packages to be compatible with PHP 8.x](https://discourse.roots.io/t/is-there-a-way-to-use-sage-9-with-php-8-1/24435/2) – also see the latest post in that thread.

If you need more help then feel free to reach out directly.

---

## Post 5 by @SimonOliver — 2024-05-08T12:08:16Z

Hi,

Thanks for that link, I’ve had a go at the solution suggested there -

I updated my composer.json to the version in Clementine\_FERNANDEZ’s post, and when I run composer update I get -

Your requirements could not be resolved to an installable set of packages.

Problem 1  
- illuminate/support[v5.6.0, …, v5.6.39] require php ^7.1.3 → your php version (8.2.0) does not satisfy that requirement.  
- Root composer.json requires illuminate/support 5.6.\* → satisfiable by illuminate/support[v5.6.0, …, v5.6.39].

I also tried hypotune’s suggestion from that thread -

% composer remove log1x/blade-svg-sage  
% composer require illuminate/support

The first part - composer remove log1x/blade-svg-sage gives me this -

Your requirements could not be resolved to an installable set of packages.

Problem 1  
- illuminate/support is locked to version v5.6.39 and an update of this package was not requested.  
- illuminate/support v5.6.39 requires php ^7.1.3 → your php version (8.2.0) does not satisfy that requirement.  
Problem 2  
- illuminate/config v5.6.39 requires php ^7.1.3 → your php version (8.2.0) does not satisfy that requirement.  
- roots/sage-lib 9.0.9 requires illuminate/config ~5.6 → satisfiable by illuminate/config[v5.6.39].  
- roots/sage-lib is locked to version 9.0.9 and an update of this package was not requested.

Removal failed, reverting ./composer.json to its original content.

And the second part - % composer require illuminate/support gives me this -

Your requirements could not be resolved to an installable set of packages.

Problem 1  
- Root composer.json requires illuminate/support ^11.7, found illuminate/support[v11.7.0] but these were not loaded, likely because it conflicts with another require.  
Problem 2  
- illuminate/config v5.6.39 requires illuminate/support 5.6.\* → found illuminate/support[v5.6.0, …, v5.6.39] but it conflicts with your root composer.json require (^11.7).  
- roots/sage-lib 9.0.9 requires illuminate/config ~5.6 → satisfiable by illuminate/config[v5.6.39].  
- roots/sage-lib is locked to version 9.0.9 and an update of this package was not requested.

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.  
You can also try re-running composer require with an explicit version constraint, e.g. “composer require illuminate/support:\*” to figure out if any version is installable, or “composer require illuminate/support:^2.1” if you know which you need.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

Thanks for your help!

---

## Post 6 by @evance — 2024-05-08T12:37:44Z

Hi Simon,

first of all it would be much easier to read your post if you used the code syntax for commands & outputs and secondly you should post your `composer.json`-contents so one can evaluate.

Sounds like you are not following all the instructions I’ve posted in that thread since the `sage-lib`-package is still at `9.0.9`?

```
"roots/sage-lib": "dev-master",
```

Please review & correct that accordingly by following the thread closely.

Unfortunately I cannot be of more help for now… You can text & hire me if you need further assistance or maybe someone else from the forum can chime in.

All the best!

---

## Post 7 by @SimonOliver — 2024-05-08T14:02:45Z

Ok thanks for your help :slight_smile:

---

## Post 8 by @SimonOliver — 2024-05-08T14:32:42Z

I’m not sure whether or not to start a new thread, but here’s an update of where I am currently with this issue.

I was able to get terminal to use php version 7.4.33, which means that I am now able to run composer install and yarn build in the theme with no errors.

However, when I try to open the website through MAMP in the browser i get the following error -

```
PHP Fatal error: Uncaught Error: Call to undefined method Dotenv\Dotenv::createUnsafeImmutable()
```

vlucas/dotenv appears to be installed, I can see the files in vendor \> vlucas/dotenv

Here are the contents of my composer.json file -

```
{
  "name": "roots/bedrock",
  "type": "project",
  "license": "MIT",
  "description": "WordPress boilerplate with modern development tools, easier configuration, and an improved folder structure",
  "homepage": "https://roots.io/bedrock/",
  "authors": [
    {
      "name": "Scott Walkinshaw",
      "email": "scott.walkinshaw@gmail.com",
      "homepage": "https://github.com/swalkinshaw"
    },
    {
      "name": "Ben Word",
      "email": "ben@benword.com",
      "homepage": "https://github.com/retlehs"
    }
  ],
  "keywords": [
    "bedrock", "composer", "roots", "wordpress", "wp", "wp-config"
  ],
  "support": {
    "issues": "https://github.com/roots/bedrock/issues",
    "forum": "https://discourse.roots.io/category/bedrock"
  },
  "repositories": [
    {
      "type": "composer",
      "url": "https://wpackagist.org"
    }
  ],
  "require": {
    "php": ">=7.1",
    "composer/installers": "^1.8",
    "vlucas/phpdotenv": "^4.1.3",
    "oscarotero/env": "^1.2.0",
    "roots/wordpress": "5.4",
    "roots/wp-config": "1.0.0",
    "roots/wp-password-bcrypt": "1.0.0",
    "wpackagist-plugin/woocommerce": "^4.0",
    "wpackagist-plugin/bootstrap-for-contact-form-7": "^1.4",
    "wpackagist-plugin/contact-form-7": "^5.1",
    "wpackagist-plugin/flamingo": "^1.9",
    "wpackagist-plugin/widget-logic": "^5.10",
    "wpackagist-plugin/wp-migrate-db": "^1.0",
    "wpackagist-plugin/megamenu": "^2.7",
    "wpackagist-plugin/woo-variation-swatches": "^1.0"
  },
  "require-dev": {
    "squizlabs/php_codesniffer": "^3.5.4",
    "roave/security-advisories": "dev-master"
  },
  "config": {
    "optimize-autoloader": true,
    "preferred-install": "dist",
    "allow-plugins": {
      "composer/installers": true,
      "roots/wordpress-core-installer": true
    }
  },
  "minimum-stability": "dev",
  "prefer-stable": true,
  "extra": {
    "installer-paths": {
      "web/app/mu-plugins/{$name}/": ["type:wordpress-muplugin"],
      "web/app/plugins/{$name}/": ["type:wordpress-plugin"],
      "web/app/themes/{$name}/": ["type:wordpress-theme"]
    },
    "wordpress-install-dir": "web/wp"
  },
  "scripts": {
    "post-root-package-install": [
      "php -r \"copy('.env.example', '.env');\""
    ],
    "test": [
      "phpcs"
    ]
  }
}

I am using nvm v10.5.3 in this project.
```

---

## Post 9 by @cheezman — 2024-05-08T14:43:52Z

Hello! Are you running on a Mac system?

Also please try running a `composer clear-cache` followed by a `composer-update`

I’ve found that sometimes a `composer install` isn’t enough.

---

## Post 10 by @ben — 2024-05-08T15:20:21Z


