Replies: 1 comment
-
|
I don't know but my code doesn't work anymore. So I tried something and now it works. The problem was PHP_EOL in the code. You should update the code like this: Also I added a OS checker to my custom SSH class. The full code is in the below. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I encountered a "General Error" when using Windows and executing a command. After investigating, I came across PR #64 and experimented with a few tweaks to resolve the issue. Here's what worked for me:
The Issue
The
<<syntax doesn't work in the Windows Command Shell. However, you can use double quotes (") instead.The Solution
I extended the
SSHclass in my project and made the following changes:Key Changes
EOFpart and replaced it with double quotes around the commands.&&between commands to ensure they run sequentially on the server.Example Usage
Here’s how I use the modified class:
Example Output
Additional Notes
To ensure compatibility, I added a flag in my project that uses this custom SSH class if the application is running on a Windows machine.
You might wonder: "Why not open a PR to fix this issue?" Unfortunately, I don’t currently have the time to contribute a proper fix with tests. Since this solution was developed for my hobby project, I didn’t prioritize making it a formal PR. Besides, I suspect there aren't many Windows users in the PHP community who would encounter this issue.
I hope this helps someone facing a similar problem. If you have suggestions or improvements, feel free to share. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions