Local Community

Local Lightning PHP 8 "Open Site Shell" does not work on ZSH

Bug Summary

I previously made a bug report about “open site shell” not working on zsh for php 7.4.1, which was solved by the Local dev team. The same exact bug is present on php 8.0, and is likely an easy fix, given that it has been fixed in 7.4.1. Here is the original bug report (with details on resolution): Open Site Shell fails on zsh, works on bash, for some php versions (ubuntu/linux)

Steps to reproduce

On Linux (.deb version), with zsh as your shell, create a site with php 8, and try to use “open site shell”. It will fail. Then change your shell to bash, and repeat. It will succeed.

Environment Info

  • What Operating System are you using?
    PopOS / Ubuntu / Debian
  • What versions of site software (Nginx, Apache, PHP, MySQL) is used?
    PHP 8, with any server and db
  • What version of Local is installed?
    6.3.x and all previous versions (I have been experiencing this for more than a year and just bringing it up again in hopes it can get some attention)

This one should be an easy win for the dev team. Any chance we’ll have a look?

Hi @tlock,

Thanks for bumping this, and apologies that you’re running into the issue with PHP 8! I found the ticket from your last post in our ticketing system, so that gives me some more details too. Let me duplicate this for PHP 8 and get it front of the dev team.

I don’t have an ETA yet, but I’ll link this thread in our ticket so that we make sure to come back here as soon as it is being worked.

Thanks,
Austin

Fantastic, thanks for the update!

Just a friendly check-up, did this get into the queue?

Hi Austin, did we get this into the queue?

Hi @tlock - it is at the top of our backlog right now, but it has not been worked yet. We’re wrapping up some Blueprints and accessibility improvements to the Local app; once those are finished, this bug and our bug around untrusted SSL certs are the first two in.

Unfortunately, no ETA yet, but I haven’t forgotten about you - you’ll be the first to know when we’ve pulled it in!

1 Like

Thanks for the update!

I have a similar issue. Open Site shell appears for a second then quits.

I have installed gnome-terminal bit still no luck.

I can see wp-cli is doing something…

where can I set which shell to use? zsh and bash work for me.

  • What Operating System are you using?
    Arch Linux
  • What versions of site software (Nginx, Apache, PHP, MySQL) is used?
    PHP 8, with any server and db
  • What version of Local is installed?
    6.3.x and all previous versions (I have been experiencing this for more than a year and just bringing it up again in hopes it can get some attention)

@ckid yup, that’s the same issue. If you need a workaround you can change to bash with chsh (chsh(1) - Linux manual page), log out, log back in.

@austinwendt any chance this is in the queue yet? Many platforms like WP Engine have already moved to PHP 8, which is really pressing this issue.

I reported this bug 1.5 years ago when it was affecting both 7.4.1 and 8, it was fixed for 7.4.1 after 4 months, but we’re still waiting on 8.0 for more than a year.

I really hate saying dramatic things like this but we’re considering moving away from LocalWP to https://lando.dev/.

@ckid I had a bit of time today to look into this, and I have a suitable fix/workaround which does not require changing shell to bash and/or logging out and back in.

I just sym-linked my system libm.so.6 into the Local Lightning php-8 shared libs directory.

Steps:

  1. Rename ~/.config/Local/lightning-services/php-8.0.0+3/bin/linux/shared-libs/libm.so.6 to libm.so.bak (your lightning services path may differ)
  2. Locate your system libm.so.6 with find /usr/lib -name 'libm.so.6'
  3. Sym-link it to into the local lightning location with ln -s <path-to-system-libm.so.6> <path-to-local-lightning-php-8-libm.so.6>

If you have doubts about what the exact issue is, and the exact location of this library file, or are trying to use another shell like fish, the following information will help you figure out anything you need:

  1. Change shell to bash, log out, log back in
  2. Open Site Shell via LocalWP menu for a site using PHP8
  3. Switch to the desired shell by calling it from the terminal directly: eg run zsh or fish, etc
  4. The shell change will fail, but the output will tell you exactly which libraries/versions are missing in Local Lightning, and their location
  5. Optional: Check your own system version with ldd --version (Optional because you already know you have the required libs by the fact that you already use that shell day to day).
  6. Sym link as per steps outlined above

@austinwendt I will stop monitoring this thread now, after 1.5 years over two tickets, but I emplore the LocalWP team to fix this issue for everyone else.

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

I understand to use WP-CLI with a WordPress site in Local you right-click the site and click “Open site shell”.

When I do this, this is the output I get:

❯ /Users/alec/Library/Application\ Support/Local/ssh-entry/u0K5N7gSI.sh; exit
-n -e
Setting Local environment variables...
----
WP-CLI:   WP-CLI 2.6.0
Composer: 2.1.5 2021-07-23
PHP:      8.0.0
MySQL:    mysql  Ver 8.0.16 for macos10.14 on x86_64 (MySQL Community Server - GPL)
----
Launching shell: /opt/homebrew/bin/zsh ...

That’s fine, but the wp command is not available:

❯ wp --version
zsh: command not found: wp

Why can’t I use WP-CLI? Does your integration not support Zsh or something?

Hi there, @alec! Thank you for bringing your question to the Local Community! :wave:

I spun up a new site with the same settings you have here (PHP 8.0.0 & MySQL 8.0.16) and when I use the command wp --version I get WP-CLI 2.6.0 returned.

Shared with CloudApp

If you start up a brand new site do you still experience this?

Let me know!

:woman_technologist:t3: Sam

Thanks for your reply @sammunoz.

I’ve tested this on two other Local sites (same result) and just tried creating a fresh site with the same result also:

/Users/alec/Library/Application\ Support/Local/ssh-entry/oSXZBuYAw.sh; exit
-n -e
Setting Local environment variables...
----
WP-CLI:   WP-CLI 2.6.0
Composer: 2.1.5 2021-07-23
PHP:      8.0.0
MySQL:    mysql  Ver 8.0.16 for macos10.14 on x86_64 (MySQL Community Server - GPL)
----
Launching shell: /opt/homebrew/bin/zsh ...

test/app/public via 🐘 v8.1.7
❯ wp --version
zsh: command not found: wp

Is “Open site shell” supposed to SSH into the Docker container that runs the site? If so this doesn’t seem to be happening.

Some more info about my shell setup:

  • iTerm 2
  • asdf
  • Homebrew
  • Zsh

The full setup can be found on my dotfiles.

Hi there, @alec!

Thank you for that information - it appears that this is a known bug with Zsh in PHP 8.0.

It was fixed in PHP 7.4 but then resurfaced with 8.0 (see this thread for more information): Local Lightning PHP 8 "Open Site Shell" does not work on ZSH - #2 by tlock

You may want to try switching to PHP 7.4 or 7.3 and seeing if that works for you!

Let me know if that helps,

:woman_technologist:t3: Sam

Thanks Sam, I’ll follow that other topic in the hope this gets fixed.

1 Like

Sounds great @alec - if you have any other questions, please do not hesitate to reach out!

Sam :woman_technologist:t3:

Hello all! :wave:

Circling back to this bug after discussing it with the Local engineering team.

At this time, we haven’t been able to reproduce this behavior. We will be testing this on the latest version of Local and PHP 8.0 on a Linux machine in the near future and will let you all know if we can reproduce this bug.

Thank you!

Sam