Once a debugger (xdebug) is enabled in phpstorm, you can then run your php script (without debugging) from within phpstorm.
How do you view the output of the script in phpstorms console?
I want to see php's output before it gets read by the browser - basically what you would see if you clicked "view source" in the browser.
Here is a video of a jetbrains dev. doing this (2mins:05sec into video) - he just doesnt explain HOW to configure phpstorm to do it.
Currently there is no such option in PhpStorm: to show web server buffer (what was sent to the browser) when debugging web page (note: this should work ONLY when debugging).
Such option did exist for a very short period about 4 years ago (separate Script Output tab in the debugger tool window: http://youtrack.jetbrains.com/issue/WI-2826 ).. but had quite a few issues and it was removed until properly implemented.
http://youtrack.jetbrains.com/issue/WI-18214 --> http://youtrack.jetbrains.com/issue/WI-4466
On that video, especially around 2:05 as you have suggested, ordinary CLI script is executed (Run/Debug Configuration of PHP Script type is used) and therefore ALL such output can be easily caught (standard std output).
With CLI scipt it's easy -- IDE is the parent here (he one who initiated script execution) so std output can easily be collected. If you execute your web page script in CLI environment, you will get your HTML in normal console output.
With web page it works differently (the whole process): script output is first sent to the web server (parent) which in turn sends it to the browser. Since IDE does not directly participate in script execution, such interception can only happen during debugging where debugger can send a copy of collected script output back to IDE.
Most web frameworks buffer the output before sending the results to the webserver. To view the contents of this buffer, first insert a breakpoint at the desired location, then when the breakpoint is reached, then goto the Debug=>Console tab and execute the ob_get_contents() function. PHP's output buffering supported nested levels, so keep this in mind when choosing your breakpoint. Obviously if the CMS/framework doesn't use output buffering then this method doesn't apply.
Related
My use case:
I kick-off a Python script from a button within Excel to do some data aggregation. The setup currently works nicely, but I would like:
Cmd to never accidentally pause - it's a known feature of the command prompt to pause on any text selection: Avoid pausing tasks when select something on PowerShell and Command Prompt
To let the cmd prompt look more like a pop-up
I have noticed NSIS installers outputs it's commands in a little logging box:
Question:
I would like to know if there are any programs out there that does most of what I want already. E.g. something like RunLikePopup.exe c:\path\to\script.bat, with output like:
Not sure what you are really after. I 'll give it a try.
In case you build an application as 'console'-only than that results in a 'command-line-interface [CLI]' Look-and-feel. Plane and simple. The output of a NSIS script (.nsi file) can not be paused as it is simply the output of the compiler executing the script code. 'Pausing' that would instantly mean pausing the compiler to do its work. I see no reason why you would want that.
Example Unix 'more' command (sending text oriented content to stdout. CLI...)
https://en.wikipedia.org/wiki/More_(command)
In case you need to 'catch' the output from the NSIS compiler here is what you need to do:
run NSIS from (Windows) CLI:
makensis [ option | script.nsi | - ] [...] > compiler_log.txt
What you appear to want is typically named 'output redirect'. (https://ss64.com/nt/syntax-redirection.html). In case you need to 'catch' the outpout from a NSIS script at compile time, please use NSIS ' CLI and redirect the (compilers) output to any text file (e.g. compiler_output.txt)
PS. In order to ensure receiving good quality answers, try to be as specific as you can in your questions.
I have written a Freeware editor ME "Martins Editor" where you can send text via inpipe:
[C:\]dir /s | me in
"in" always shows the first page (does not scroll), "ins" scrolls and "inp" scrolls page by page. In this context, "me in" is a substitute for "more".
Then you will see the output in the editor. ME is a simple editor with the focus on multiplatform text (different EOL encodings, codepages). It has additional Wordstar ("IDE classic") key setting and HTML/XML highlightning. It is available for Windows, OS/2, Linux and MacOS.
http://www.hypermake.com/english/betatest.html#hd117
The 2016 version is still current. In the next weeks, I publish a new version.
I am working on a cmd.exe window replacement (commandline frontend) "MeShell" based on ME with look-and-feel of a normal commandline window. Because on the lack of a modern comfortable commandline window on the old OS/2 platform which is still alive (http://www.arcanoae.com), I will publish an OS/2 version first. If this version works fine, I will publish a Windows version later. In the context of MeShell, I improve the inpipe functionality of ME which is still buggy and does not support colors in the 2016 version.
I have a DLL which does as plugin into the TS3 client.
The problem is, the plugin provokes a crash that I cannot seem to find in my code directly.
So my idea is to set the Console Output of the console windows in the background (-console option) to a file, because when the program crashes there is no way I can read the console output as the console disappears immediately.
Is there a way to set the output of a crashing console to a file?
Because so far, when using the stdout operator (ts3client_win64 -console > output.txt) it does not write anything to the file. (I assume it cannot close the file handle and loses all its data?) But I want to keep the console output when the crash occurs.
It also has to be said that I can not just run it with a batch file and a pause statement, because when starting the application it opens its own console window (and thats the one of which I want the output).
It is the type of crash one would get from failed (safe) string operations in C like strtok_s or strcpy_s.
I am trying to control and read the output of a 3rd party console application, of which source code I cannot change.
I want to use QProcess for this, but this should not matter, as the issue is the same when just using cmd:
The 3rd party app seems to never call flush().
Therefore, directly calling it in cmd.exe works fine(Output appears in cmd window), but when calling e.g.
3rdPartyApp.exe > Output.txt
Output.txt stays empty until 3rdPartyApp.exe terminates or quits.
After 3rdPartyApp.exe quits or is terminated, all stdout can be found in Output.txt .
Question:
What can I do to create an environment where the buffer size of the pipe is limited, like when calling directly in cmd.exe, which seems to limit the buffer size to one line?
What you can do is create your own Console type application that will run 3rd party process and "handle" buffering of it.
Then instead redirecting output of 3rd party application, you simply redirect output of proxy console app.
How to do it? You can read it here: https://www.codeproject.com/Articles/16163/Real-Time-Console-Output-Redirection
The author provides explaination and ready to use Console app called RTConsole.exe.
I had big time issue to get unbuffered output from 3rd party pyhton executable spawned from my .NET app and this RTConsole.exe saved me.
I am trying to run some commands using the console in windows 8. My problem is that I have a hard time debugging an application I build, as the response I get after some commands is too big. I have maximized the window but I can only view some lines (50-60 does not matter).
How can I view everything from the beginning to the end?
I am using VS express 2012 to run a code that display content of many files. I found that first files content do not show and when I debug step by step I found that the content show on the console window and disappear when other results show, which means they get pushed out of the window. of course I scroll up and I find the latest files only not all. Is there any option control this feature? and how can I see all results?
To avoid this you should convert your console application to a Windows Forms one and put all the output on a TextBox. Just execute the command on the Form load and redirect all the output to the TextBox.
It's not much work IMHO.
This is the nature of a console application, no different than if you were to echo data to the Windows command prompt. If there is too much data then of course it will scroll off the visible screen.