php-shellcommand | simple object oriented interface to execute shell commands | Script Programming library
kandi X-RAY | php-shellcommand Summary
kandi X-RAY | php-shellcommand Summary
A simple object oriented interface to execute shell commands in PHP
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Execute the command
- Adds an argument to the command line .
- Sets the command .
- Set configuration options
- Get executable command
- Set the arguments
- Sets the stdIn .
- Returns the current command
- Get the command line arguments .
- Get the output .
php-shellcommand Key Features
php-shellcommand Examples and Code Snippets
Community Discussions
Trending Discussions on php-shellcommand
QUESTION
i'm stuck for two days now on the same issue.
I'm trying to create a commit and push it to my remote repository using shell commands throw with PHP.
I'm able to do a git add or a git commit but not a git push. When I try to use stream_get_contents
on the pipe opened by proc_open('git push [...]');
, it does an infinite loop and I can't see any result or errors ...
I tried to put a timeout or set non-blocking mode but nothing change in the execution. I also tried to print the user with whoami
and I get 'nt authority\system' but I don't know what to do with that.
After looking for many PHP forums and libraries on GitHub or GitHub API, I didn't find any solution who works for me (maybe I did them wrong?).
Here somes links who I have looked:- Running git pull from a php script (I'm on Windows OS not linux)
- https://github.com/mikehaertl/php-shellcommand (Infinite loop too)
- https://github.com/kbjr/Git.php (Infinite loop too)
- https://docs.github.com/en/rest/reference/repos#contents (Can upload or modify a file in a repo but not an entiere commit)
- https://github.com/mikehaertl/php-shellcommand/issues/20#issuecomment-521752406 (Infos ...)
- Git (v2.24.1.windows.2)
- PHP (v7.4.0)
- Wamp Server (v3.2.0)
- Windows (v10.0.18363.1082)
ANSWER
Answered 2020-Sep-29 at 08:09A few weeks later, I finally found the source of the problem. It was not proc_open but stream_get_contents that blocked me. When I done a git push, my system ask me for enter my git's username and password but executed by PHP, I don't have a terminal instance to put my values so stream_get_contents still wait to an entry who never comes.
I used git config
to set my repo credentials and then it works !
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install php-shellcommand
PHP requires the Visual C runtime (CRT). The Microsoft Visual C++ Redistributable for Visual Studio 2019 is suitable for all these PHP versions, see visualstudio.microsoft.com. You MUST download the x86 CRT for PHP x86 builds and the x64 CRT for PHP x64 builds. The CRT installer supports the /quiet and /norestart command-line switches, so you can also script it.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page