Menu

How to execute php and capture its output

Andrea M.
2008-12-04
2012-11-13
  • Andrea M.

    Andrea M. - 2008-12-04

    Maybe I'm missing something and I just couldn't do this from the simple "run" command on n++, this is how I did it, hope it helps:

    1) Create somewhere on your PATH a file named n++script.bat (any other name will work of course) with the following two lines:

    php %1 > "c:\temp\tempoutput" 2>&1
    "C:\Program Files\Notepad++\notepad++.exe" c:\temp\tempoutput

    You can change the n++.exe directory if you have a different one; similarly, make sure there exists a c:\temp directory

    2) in n++, click the "run" menu and type the following:

    n++script.bat  "$(FULL_CURRENT_PATH)"

    That's it... running this will execute your php and will open a window with the file tempoutput containing the standard output of the php script and the standard error

    If you want only the standard output, remove the 2>&1 part in the first line of the script

     
    • Harry

      Harry - 2008-12-05

      YOu may also want to try NppExec, I think it can do that (and more) all interanally so you dont even have to manually update. Dont have a manual for it though

       
    • cocinerox

      cocinerox - 2008-12-04

      Have you tried the DocMonitor plugin?

      http://sourceforge.net/project/showfiles.php?group_id=189927&package_id=231308

      It allows you to continuously monitor the output file, so you don't have to reopen it with a batch file. Check the File Status Auto-detection settings as well.