I am trying to figure out how to run a command line program within php and output both stout and stderr to a variable. All the examples either output the command line directly to the screen, or only output stdout for example will output the following directly to the screen and not store anything in $data And the following will
Tag: command-line-interface
Setting up PHPunit – PHP CLI is not executing the shell script
I’m in a multi developer program. The other developer installed PHPUnit via composer and successfully is running tests. I took the composer files, ran composer update, but when I try to run the tests, I am receiving this error: Output: This is the content of the phpunit shell script. The shebang first line #!/usr/bin/env sh is not being output, but
PHP: How to use STDIN to get secret input for passwords on Linux based systems
What is the most up-to-date way to get input from STDIN but not see what was typed in PHP CLI mode, so things like passwords are not shown? Difference being, only on Linux based systems like Ubuntu, …
Class ‘MagentoSetupApplication’ not found, after executing “git reset –hard”
I executed git reset –hard, but now I get: I executed composer update in hope that this fixes it, but it doesnt. How can I fix? Answer It turned out that git reset –hard destroyed my setup folder for unknown reasons and not even git pull fixed it. So I had to copy the folder from another project. Now it
Container Registry TYPO3 not available
At deployment getting the following exception when trying to invoke a typo3 cli command. ./typo3cms list. At local env this does not occur Answer The occurs due that the composer.json and composer.lock are not deployed to the machine were the command is executed. In these file a configuration/bootstrap is setup which is needed to invoke these commands.
Adding clippath information to an image
I’m trying to add a clipping path to a TIFF image. I made one TIFF file with GIMP that contains a clipping path and I can clip my image using it by $img = new Imagick(“./test.tiff”); $img->…
How can I fix which version of Windows PHP is being used for the CLI?
I have WAMPServer 3.0.6 with PHP 7.0.10 Installed. I use Git Bash to use server side cli for my projects, mainly Laravel. There’s a package that needs PHP 7.0 to work and even tought my WAMP Server is …
How to start a php script from cli within wordpress
I wrote a PHP script, which was meant to be a WP-Cron-cronjob and which uses wordpress specific functions. Due to some restrictions in its runtime enviroment, I need to start this script from the command line with /usr/bin/php -q longThing.php instead of as a WP-Cron event. How can I ensure that all the wordpress core functions are callable in my
PHP: Adding Arrow Key Support to STDIN/Single Character Processing
In PHP, I can read in input from a command line program with the following code This works well for simple input. However, if I try to use something like an back arrow key, my shell looks like the following i.e., the arrow key escape sequence of ^[[D is sent to the shell. PHP itself will interpret the arrow keys
Xdebug laravel artisan commands
I regularly use xdebug to debug applications, I’ve built a laravel application that takes an upload of a csv inserts the data to the database and the ids to a job queue. I’ve written an artisan …