Local site worked well for a week, then not at all

What issue or error are you experiencing?

Site will not display, responds with error
From Firefox, URL is svold.local:

Service Unavailable

The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

What steps can be taken to replicate the issue? Feel free to include screenshots, videos, etc

Click Open Site in Local app

I’ve tried Safari and Firefox browsers, same error.

My local site svlocal worked fine for a week, then I always get the error above when trying to open the site.


System Details

  • Local Version:
    Version 9.0.2+6676
  • Operating System (OS) and OS version:
    MacOS 14.4.1

Local Logs

Attach your Local Logs here

I tried several times but could not upload local-logs.zip, so I am just pasting in the log files that will fit in the character limit.

local-details.json
{“details”:{“device_info”:{“platform”:“darwin”,“release”:“23.4.0”,“arch”:“arm64”,“totalmem”:17179869184},“local_info”:{“version”:“9.0.2+6676”,“loaded_addons”:,“lightning_services”:{“apache”:{“2.4.43”:{“name”:“apache”,“label”:“Apache”,“version”:“2.4.43+8”,“binVersion”:“2.4.43”,“registered”:true,“platform”:“darwin”}},“mailpit”:{“1.12.1”:{“name”:“mailpit”,“label”:“Mailpit”,“version”:“1.12.1+0”,“binVersion”:“1.12.1”,“registered”:true,“platform”:“darwin-arm64”}},“mysql”:{“5.7.28”:{“name”:“mysql”,“label”:“MySQL”,“version”:“5.7.28+4”,“binVersion”:“5.7.28”,“registered”:true,“platform”:“darwin”},“8.0.16”:{“name”:“mysql”,“label”:“MySQL”,“version”:“8.0.16+6”,“binVersion”:“8.0.16”,“registered”:true,“platform”:“darwin”}},“nginx”:{“1.16.0”:{“name”:“nginx”,“label”:“nginx”,“version”:“1.16.0+7”,“binVersion”:“1.16.0”,“registered”:true,“platform”:“darwin”}},“php”:{“7.3.5”:{“name”:“php”,“label”:“PHP”,“version”:“7.3.5+14”,“binVersion”:“7.3.5”,“registered”:true,“platform”:“darwin”},“7.4.30”:{“name”:“php”,“label”:“PHP”,“version”:“7.4.30+6”,“binVersion”:“7.4.30”,“registered”:true,“platform”:“darwin-arm64”},“8.1.23”:{“name”:“php”,“label”:“PHP”,“version”:“8.1.23+0”,“binVersion”:“8.1.23”,“registered”:true,“platform”:“darwin-arm64”}}}}}}


Security Reminder
Local does a pretty good job of scrubbing private info from the logs and the errors it produces, however there’s always the possibility that something private can come through. Because these are public forums, always review the screenshots you are sharing to make sure there isn’t private info like passwords being displayed.

Sorry that you ran into this, @JeffR. You could try this:

  1. Quit Local.
  2. Open the Finder and choose Go → Go to folder.
  3. Input this path including the leading ~/ and press enter: ~/Library/Application Support/Local/
  4. In the “Local” folder that opens, find and delete the lightning-services folder.
  5. Start Local.
  6. Try to start your site.

If it doesn’t start, try creating a new site with the same PHP version as the current site, then restart your old site.

Thanks for the response.

Deleting the folder didn’t work.

I created a new site with the same php version, but when trying to start the site, I got:

OK, I tried:

  • deleting all Local sites and adding a new site

  • deleting Local application and re-installing, then adding a new site

  • rebooting my Mac

  • switching from Safari to Firefox
    In all cases, I got the same error:

    502 Bad Gateway


    nginx/1.16.0

  • switched to Chrome, created a Trust certificate.
    FINALLY I was able to open the site. I have no idea why this worked when Safari was working well with the old site for several days.

Jeff

I spoke too soon. Trying to go to the Dashboard reproduced the old error.

So I Trusted the certificate,

Tried running wp-cli, to correct the URLs, but I get this error for all commands:
JeffMacBookAir@JEFFROB-M-602G public % wp search-replace

Notice: Undefined index: SERVER_NAME in
phar:///Applications/Local.app/Contents/Resources/extraResources/bin/wp-cli/wp-
cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1323) : eval()'d code on line 19

Hi @JeffR

Can you share a full local log here for us? There are some different ways to access and share Local Logs. For us to be able to troubleshoot thoroughly, please click the Download Local Logs button from the Support tab in Local. This will generate a zip archive that contains the Local log along with some other diagnostic information to help quickly zero in on any issues that Local is encountering.

Sure here you go.

Did you see my follow-up message? I tried deleting all sites and the Local app, re-installing it and recreating the site under another name. I still got the 505 Bad Gateway warning, so I opened KeyChain and made the certificate trusted. No change. There’s a follow-on step to change URLs in the database to https but the WP CLI utility would only give errors, also shown in the follow-up message.

I’m running MacOS 14.4.1 on Apple Silicon. I’ve tried Safari, Chrome and Firefox browsers, same result.

I appreciate any help you can provide. I really need the local site as a backup as I switch hosting providers next week.

Jeff

local-logs1.zip (11.4 KB)

When you’re spinning up your sites are you using a specific configuration? Or have you tried both with custom and preferred types?

Does changing your Router Mode make any difference? Preferences>Advanced>Router Mode

Nick,

The only customization I use is the PHP version 7.4.30. I need that because the site breaks if I run the latest PHP version and I’ve never found where the error is.

The curious thing is that the site ran fine for about a week, then this 505 error. It also ran for a short while in Chrome but when I went to the Dashboard, I got the 505 error and it stopped working.

Jeff

Nick,

Starting up a site with the same PHP version had no effect, although I could start the new site.

I tried turning on Xdebug but I’m not sure if it would help, or even how to invoke it.

Any other brilliant ideas? I’m stuck.

Jeff

So you were able to create and start a new site @JeffR? Was this just a blank site?

Yes, a new, blank site could open fine.

Jeff

Can you re-import the site that was having issues into a new install and try it again?

You could try a reimport like this:

  • Locate the site files on your machine, and save a copy of them to your desktop. If you click Go to Site Folder under your site name it should take you right to where they are located.
  • Once you have those copied, completely delete the site from Local
  • Restart Local/your machine
  • Reimport the site back into Local. You can refer here on how to Restore from only Local site files

You could also try manually moving the files and DB into a new, blank site using the steps here:

Manually Import a Local Site

Thanks - is it worth trying to re-import the site from the .zip file that was used to create it originally? That worked, temporarily.

Jeff

You could try it! You could try either the zip “drag and drop” import or you could open it up and use the manual import steps in that link I shared above.

Nick,

I deleted the host files, upgraded to the latest version of Local, imported the originally exported zip file and specified localhost for the Router Mode and got a different error this time. Maybe it’s progress, I’m not sure. See screenshot. Log is attached too. The error_log was 0 bytes.

local-lightning.log (181 KB)

Is this still just with the site you imported? What happens when you create a new site and try to access that?

Nick,

If I create a new site, it works fine. However when I import from my Wordpress zip file export, then I have this problem and can’t use the site.

Jeff

I’m seeing a few errors in the Local log that could mean that the MySQL db is having some trouble initializing:

{"class":"Process","level":"warn","message":"2024-06-26T19:28:45.841622Z 0 [Note] %%userDataPath%%/lightning-services/mysql-5.7.28+4/bin/darwin/bin/mysqld (mysqld 5.7.28) starting as process 16137 ...","process":"mysql","thread":"main","timestamp":"2024-06-26T19:28:45.842Z"}
{"class":"Process","level":"warn","message":"2024-06-26T19:28:45.841655Z 0 [ERROR] Can't find error-message file '/usr/local/mysql/share/errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.","process":"mysql","thread":"main","timestamp":"2024-06-26T19:28:45.843Z"}

Those aren’t definitively the problem, but you might try creating a new site like you have, and then manually copying over the files and importing the DB. That process is covered in more detail within this help doc:

Thanks, I followed the instructions importing the db .SQL file but ran into problems. The closest I got was this in MacOS Terminal. Is it the database.sql file from the export that I should be using?

JeffMacBookAir@JEFFROB-M-602G public % sudo -u ‘Jeff Roberts’ -i – wp db import /Users/JeffMacBookAir/Desktop/Local backups/siskiyouvelo-20240512150410/database.sql

Error: This does not seem to be a WordPress installation.

The used path is: /Users/JeffMacBookAir/

Pass --path=path/to/wordpress or run wp core download.

JeffMacBookAir@JEFFROB-M-602G public %