![]() |
| Remote CLI SSH debug on Windows server does not from the IDE |
|
Site Admin
|
Thank you for posting this.
Could you check what `echo $0` returns in your terminal? On Linux, it prints the shell type (for example, bash). If you are using bash, it should normally work without issues. However, it's not a Linux environment. In any case, you can validate your project using the Project Settings Wizard. You can find this button in the Project Properties dialog. The wizard gathers information about PHP and the debugger on your server, then posts a diagnostic log. If it detects any known issues, it may also suggest possible fixes. You can reply here or in the ticket that you opened with support. |
||||||||||||
|
_________________ The PHP IDE team |
|||||||||||||
|
Hi Dmitri,
Yes, on an SSH Ubuntu, if I type `$echo $0`it will reply `-bash` on Windows SSH replies `$0`. Maybe if it about how to get information about the shell is running on windows `echo %SHELL%` which will reply `c:\windows\system32\cmd.exe` on Ubuntu `echo $SHELL` reply `/bin/bash` Do you think it needs to detect the shell that it's running? Do you think it needs a bash shell on windows? I have the Git SCM installed on the server which provides a bash shell. I could try to see if I can change the shell on the Windows OpenSSH server. However, it will be better if there is a solution without doing these hacks. I tried to run the wizard settings; all validations pass until arrive to validate the CLI, which does what I described before. If I skip this part and continue, save the project, I can without problem Debug HTTP, but not CLI. On a local installation (of the same projects), I can run the Wizard Settings complete without problems both HTTP and CLI. |
||||||||||||
|
|
|||||||||||||
|
Site Admin
|
it needs to detect the shell, otherwise it can’t reliably execute commands or interpret their output. It used to support cmd.exe, but I’m not sure what changed in Windows 22. Can you work with unix-compatible shells under Windows for now? Cygwin or may be similar alternatives. Git comes with a good shell too.
As of the Wizard, don't cancel it, give it at least 30sec |
||||||||||||
|
_________________ The PHP IDE team |
|||||||||||||
|
I currently I'm trying to change the shell from the OpenSSH server. I will let you know if I can change it and if that helps with the debugger.
When I am run the CLI debugger on the IDE, runs for 30 seconds until show a pop-up that has failed. The SSH terminal shows this: hxxps://postimg.cc/njyFhLL2 When I run the Wizard, it gets this: hxxps://postimg.cc/t19D8dNb Until it fails like this: hxxps://postimg.cc/sQhBcqGF |
||||||||||||
|
|
|||||||||||||
|
Ok I was able to change the Shell from `cmd.exe` to git `bash.exe`. It's a little better, it is able to submit commands but still end up with not debug. No sure why has to submit so many `echo "phped.21.0.0.21033"`. Here is the screenshot of the result.
hxxps://postimg.cc/5Y7NvMm3 Unfortunately, I cannot test if this works on Linux as I have no server with the debugger module installed. |
||||||||||||
|
|
|||||||||||||
|
Site Admin
|
Thank you for the update. We need to check how it works internally when running bash / MINGW on Windows.
The repeated echo "phped.21.0.0.21033" appearing on a single line may be related to differences in line endings. Windows does not handle \n correctly on its own and typically expects \r\n. Previously, we tested only with Cygwin and the native shell. To test compatibility with the native Windows shell, you could try using a Telnet connection instead of SSH. Windows servers come with Telnet service. Telnet client is built-into PhpED. You can give it a try. |
||||||||||||
|
_________________ The PHP IDE team |
|||||||||||||
|
Unfortunately, I will not be able to test it on Telnet as this server is on production and on public network. It will be a "no-no" from our security team. In the past because I couldn't install a reliable and affordable SSH server on windows, we ended installing PhpEd on the server and RDP only for the purpose of debugging. Since Windows 2022, OpenSSH is included on the installation of the OS. I have been installing it for remote debugging HTTP without issue. But until now that I have to debug a CLI script, I am finding this problem.
Now that I know that I can change the sell, I could see if I find a Cygwin bash shell for windows to test with it. Yes, on the `cmd.exe` shell it makes sense all those echoes are on one line, it output them until times out. But on `bash` shows them on different prompts while executing the same script from 3 to 30 times, depending on the mood. It continues with one `echo $0`, one `env` and it ends with 2 empty prompts. Stays here until times out. |
||||||||||||
|
|
|||||||||||||
|
Site Admin
|
For the purposes of PhpED development, we haven’t concidered Windows as a remote platform for PHP cli development, as it’s clearly not very popular in that role. I didn’t realize that, in your case, it is actually used in production. Of course, Telnet is not an option, and, by the way, it hasn’t been included as a Windows component since around Windows 8 or 10. We will improve support for Windows as a remote platform for CLI debugging in the next version.
Cygwin setup is straightforward. Download the Cygwin setup executable, run it, and select the openssh component for installation (it may offer multiple versions, including non-production debug or test builds). After installation, run cygwin.bat, in the the shell execute the ssh-host-setup command. If you don’t enable the isolation option, sshd will work as a service out of the box. With isolation enabled, it may require a few additional tweaks, if I recall correctly. |
||||||||||||
|
_________________ The PHP IDE team |
|||||||||||||
|
Site Admin
|
PHP CLI debugging works under Cygwin.
In my setup, all project files are stored remotely on the Windows server. Project root: [SFTP:win22] /cygdrive/c/Users/Dmitri/Documents/Projects Run target: remote server Remote root directory: C:UsersDmitriDocumentsProjects Terminal account: ssh-terminal-win22 PHP executable: /cygdrive/c/Users/Dmitri/AppData/Roaming/NuSphere/php83/php.exe Make sure there are no spaces in the path to php.exe I did not configure SSH port forwarding (tunneling) for debugging because the server is on the same local network. However, you may need to set up a tunnel if your server is on a different network. and Windows Firewall should explicitly allow ssh port for external connections. Below is power shell command I used
|
||||||||||||||
|
_________________ The PHP IDE team |
|||||||||||||||
| Remote CLI SSH debug on Windows server does not from the IDE |
|
||
|
Content © NuSphere Corp., PHP IDE team
Powered by phpBB © phpBB Group, Design by phpBBStyles.com | Styles Database.
Powered by
Powered by phpBB © phpBB Group, Design by phpBBStyles.com | Styles Database.
Powered by


RSS2 Feed