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

Correct. You’ll either need to reference it from the folder where it’s located, or move it into the app/public folder so that it’s at the site root and easily accessible to your shell.

You typically don’t need to use sudo for this command. I imagine it would work wit:

wp db import /Users/JeffMacBookAir/Desktop/Local backups/siskiyouvelo-20240512150410/database.sql

Can you give that a shot and let us know how it goes?

Yes, I tried that before, but it doesn’t recognize “wp”:

cd /Users/JeffMacBookAir/Local Sites/siskiyou-velo-local/app/public

Last login: Wed Jun 26 13:52:50 on console

JeffMacBookAir@JEFFROB-M-602G ~ % wp db import /Users/JeffMacBookAir/Desktop/Local backups/siskiyouvelo-20240512150410/database.sql

zsh: command not found: wp

I also tried using csh:

JeffMacBookAir@JEFFROB-M-602G ~ % csh

[JEFFROB-M-602G:~] JeffMacBookAir% pwd

/Users/JeffMacBookAir

[JEFFROB-M-602G:~] JeffMacBookAir% wp db import /Users/JeffMacBookAir/Desktop/Local backups/siskiyouvelo-20240512150410/database.sql

wp: Command not found.

[JEFFROB-M-602G:~] JeffMacBookAir%

I tried going into Local Sites/app:

JEFFROB-M-602G:~/Local Sites/sv-local] JeffMacBookAir% cd app/public

[JEFFROB-M-602G:sv-local/app/public] JeffMacBookAir% ls

database.sql wp-comments-post.php wp-load.php

index.php wp-config-sample.php wp-login.php

license.txt wp-config.php wp-mail.php

local-xdebuginfo.php wp-content wp-settings.php

readme.html wp-content-old wp-signup.php

wp-activate.php wp-cron.php wp-trackback.php

wp-admin wp-includes xmlrpc.php

wp-blog-header.php wp-links-opml.php

[JEFFROB-M-602G:sv-local/app/public] JeffMacBookAir% whereis wp

wp:

[JEFFROB-M-602G:sv-local/app/public] JeffMacBookAir% wp db import /Users/JeffMacBookAir/Desktop/Local backups/siskiyouvelo-20240512150410/database.sql

wp: Command not found.

I’m not sure why sudo lets it find wp, maybe the path changes.

Jeff

How are you accessing the terminal? Are you clicking the button within Local that says “Open site shell?”

If you can, please take a screenshot of the terminal window so we can get a better idea of the context of these commands.

The reason I’m asking about how the terminal was opened is that you’ll need to click the “Open site shell” to have Local configure the various env vars to access wpcli, php, mysql, etc.

If you are using the “Open site shell” button, then I’d be curious to know what your PATH looks like since it seems like Local might be having trouble updating the env vars for that shell. You can get an idea of the various items in your path by:

  1. Clicking “Open site shell”
  2. Running this command: echo $PATH | tr ':' '\n'

Here’s what that command looks like on my machine:

Ben,

I haven’t been doing that consistently, more often I just open Terminal.

When I do Open Site Shell and run that command, I get the screen below. I’m not sure what I should be looking for…

Jeff

That would be why wpcli can’t be found. In order for the shell to be able to communicate with the WordPress site, you need to click the “Open site shell” button so that the various env vars can be set.

Basically, what that command did was list out all the locations of the PATH variable. The PATH variable is a colon separated list of places that the shell will look for binaries to execute. Lines that are higher up, have more precedent than lines that are lower.

Notice those lines that start with /Applications/Local.app/...? Those are how the shell can find composer, wp-cli, php, and mysql.

If you were to run that same command in a plain shell, you wouldn’t see those entries in the PATH variable, which is why the commands didn’t work.

Given all that, I think you should be able to finish manually importing the site within a shell that was opened with the “Open site shell” button. Can you give that a shot and let us know if that allows the site to be imported?

OK, that worked better. The site was very slow to load, about 30 sec, and then it’s as if CSS and Javascript didn’t load - see screenshot:

Jeff

I tried copying over the wp-includes directory since the CSS and JS files are there, restarting the site, but to no effect.

I see that if I click a link for a page, the browser tries to find the full URL using https, such as: https://www.sv-local-new.local/, where “sv-local-new” is the name of my Local site.
Are the links supposed to be https?

I recall that this site’s links were coded as full URLs, not relative URLs.

I keep recalling that originally the site worked fine, including links. So something happened to break it.

Jeff

You usually don’t need to copy anything within the wp-includes folder. That’s where WordPress core files live and usually they don’t have anything to do with the front-end of the site.

From the screenshot it does look like the content is there, it’s just the CSS that’s missing. You can verify that by opening the browser dev tools and seeing what kinds of errors are in the console.

The fact that you are seeing links to HTTPS urls indicates that the site might benefit from searching and replacing to regular HTTP.

To do this:

  1. Open the site shell
  2. run a search-and-replace using wp-cli

You’ll want to use the correct name for the site, but here’s the command that I use to replace all the urls within the DB (note that the second string doesn’t have an “s” and neither url has a slash at the end):

wp search-replace 'https://www.sv-local-new.local' 'http://www.sv-local-new.local'

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.