Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


Advertisements:




SuperbHosting.net & Arvixe.com have generously sponsored dedicated servers and web hosting to ensure a reliable and scalable dedicated hosting solution for BigResource.com.







Slow Down The Output From A DOS / Windows Command Prompt


I have lots of experience of writing php scripts that are run in the context of a webserver and almost no experience of writing php scripts for CLI or GUI output. I have used the command line for linux but do not have much experience with DOS. Lets say I have php script that is:

<?php
echo('Hello world');
for ($idx = 0 ; $idx < 100 ; $idx++ )
{
echo 'I am line '. $idx . PHP_EOL;
}

Then, I run it in my DOS Command prompt:

# php helloworld.php

Now this will spurt out the output quickly and i have to scroll the DOS command window up to see the output. I want to see the output one 'screen full' at a time. How do you do that from the perspective of a DOS user? Furthermore, although this is not my main main question, I would be also interested in knowing how to make the php script 'wait for input' from the command prompt.


View 3 Replies (Posted: )

Sponsored Links:

Related Forum Messages:
Open Matlab Using Windows Command Prompt?
is there any php function to open Matlab using Windows Command Prompt

Posted: Apr 30 at 13:22

View 1 Replies!   View Related
Show CMD Command Prompt Window (Windows)?
Usually, you would want to hide the CMD window. In my case, I'll be doing some tests with PHP+CLI. It will be mighty useful if PHP could be made to launch a CLI popup. But alas, I can't find a way to make it to. The following command should have made it work, but it doesn't: START "PHP AE2" CMD /K DIR The PHP code in question is based on proc_open():

$proc=proc_open($cmd,array(
0=>array('pipe','r'), // STDIN
1=>array('pipe','w'), // STDOUT

[code]....

Although the command runs fine, the popup doesn't show up. I suspect this is a feature of Apache. Is there a way to completely detach the CMD from its parent? Also, I'll be substituting DIR with a small script/batch/program that initializes the environment, so it is important that I can execute a program after the popup shows up.

Posted: May 30 at 14:48

View 1 Replies!   View Related
Calling Windows Program From File (through Command-prompt)
I have tried calling a windows program several ways and I have gotten the same result each time. The program opens up on my machine (without a GUI) but never closes each means that the browser is forever loading. Though when executing the query string manually through the command line prompt the program closes. Not only that, but the program doesn't actually execute (it is just launched i.e. there aren't any results).

I just want to know the proper way of starting a program with switches through PHP. here is the query string that works (closes the program after executing):

"C:Program Files (x86)Softinterface, IncConvert PowerPointConvertPPT.exe" /S "C:UsersFarzadDesktopupload est.ppt" /T "C:UsersFarzadDesktopupload est.png" /C 18

Posted: Mar 8 at 16:26

View 4 Replies!   View Related
Tracert :: Passing Command To Command Prompt Via Exec
I want to execute a "tracert" command in the command prompt via php (using windows)

I've managed to use passthru() to open the command prompt (but it doesn't allow me to use it) and when I close it, it outputs the command prompt output in the browser.

I don't mind whether the result is passed back to the browser to stays in the command prompt window (but that would use exec() I would think).

So how can I tell the command prompt that launches to execute the line

tracert 192.190.201.273

So far my experimental code is:

<?php
passthru("c:windowssystem32cmd.exe");
?>

EDIT: my backslashes have been stripped from the path, but you know what I mean!

Posted: 09-02-2004, 08:18 AM

View 3 Replies!   View Related
External Command Prompt
I have a .bat file stored locally that I would like launched from PHP.

Here's the code I've tried using:

exec("cmd /K test.bat");

The PHP script that contains the code above hangs when executed. What is the correct way to do this? Or is there a way to have PHP display the output from the .bat file on the fly (as opposed to waiting for the .bat file to execute THEN dump the output?) .

Posted: 7:52 pm on July 5, 2007

View 1 Replies!   View Related
Command Prompt Shortcut
Be grateful to know the trick of being able to use F12 to test with the browser in Dreamweaver when Apache and localhost are present? There is a way to have a shortcut to mysql in the Command Prompt, to save that rigmarole of changing directories all the way through from the root. Be v pleased if an Expert could pass on this tip.

Posted: 11-23-2005, 06:38 AM

View 2 Replies!   View Related
How To Run Cronjob On Command Prompt?
How to run Cronjob on command prompt?

Posted: 11-20-2007, 08:27 AM

View 1 Replies!   View Related
Pdf2swf In Command Prompt?
need to convert pdf file to swf file using php code,.am using this code.

$software_path ="C:\xampp\htdocs\pdf2swf\check\pdf2swf" ;
$pdf_path ="C:\xampp\htdocs\pdf2swf\test.pdf" ;
$argument = "-o";

[code]...

Posted: February 10th, 2010, 08:11 PM

View 5 Replies!   View Related
How To Run Script In Command Prompt
i wanna know how can i run my php programme in dos command prompt window?is that require any modifications in php script?

Posted: Posted 24 March 2006 - 06:21 AM

View 2 Replies!   View Related
Get Rows In Mysql At Command Prompt
This question really belongs more in a mySQL group, but my NNTP server
doesn't have a mySQL group available.

I'm trying to get number of rows in a table without doing a "select * from
table" or even a "select id from table". I know in PHP you put:
mysql_numrows() but what's the equivelant in command prompt?
I searched mysql.net and can't find anything.

Posted: July 17th, 2005 04:46 AM

View 6 Replies!   View Related
Sockets Enabled But Not In Command Prompt
I have a slight problem that I can't seem to figure out on my Vista machine running Apache 2.2 and PHP 5.2.3. I have sockets enabled, and all runs fine when I test it in the browsers (any of them). Main focus would just be socket_create for now. Now when I test this by command prompt (and of course using correct heading info #!/usr/bin/php -q), it gives a "Call to undefined function socket_create".

So I looked further into this, just to make sure sockets were enabled, I used phpinfo() and sure enough its there. But when I run the same script by command prompt, everything is there except sockets. It just does not show up. Here is the test script I am using.

if (($master = socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) < 0) {

echo "socket_create() failed, reason: " . socket_strerror($master) . "";

}else{
echo " socket_create() worked!!";
}

As I said above, it works fine with a browser, but does not work by command prompt.

Posted: June 05, 2007, 10:03:31 PM

View 2 Replies!   View Related
Stop A Script From Command Prompt?
I am running a PHP script and it takes a long time to execute (parsing huge CSV file).How can I stop the script?It seems from command prompt you can run:> kill $pidBut I do not know how to find out the pid...

Posted: Feb 9, 2009, 23:28

View 10 Replies!   View Related
Executing .jar File Through Command Prompt?
I have a .jar file which has a command line interface. I want to call the jar file through command prompt and capture the output of the Jar file.I have tried with the exec() command.The command I have used is:

<?php
exec('java -jar D:\Development\Filehandler\dist\Filehandler.jar getConfigLang', $result);
echo $result;

[code]...

Posted: Jul 15 10 at 9:33

View 1 Replies!   View Related
Run Wordpress Code From Command Prompt?
I need to run custom WP script from command line : php myscript.phpWhatever I do it doesn't work. I get this message:Error establishing a database connectionI tried

define('DOING_AJAX', true);
define('WP_USE_THEMES', false);
$_SERVER = array(

[code]...

Posted: Mar 3 at 15:30

View 2 Replies!   View Related
Execute .jar File Through Command Prompt?
I have a .jar file which has a command line interface. I want to call the jar file through command prompt and capture the output of the Jar file.I have tried with the exec() command.The command I have used is:

exec('java -jar D:DevelopmentFilehandlerdistFilehandler.jar getConfigLang', $result);

Should something else be done before executing this command? like adding path etc???

Posted: Jul 15 10

View 1 Replies!   View Related
Win Xp System Inside Command Prompt?
On my win xp system inside command prompt Im getting the weird error message when I press button ''Run'' in software which is being made in PHP. I open it without any error message but once I clicked Run, the error occurs. The message is:PHP Warning: wbExec: Could not run application C:path1filename1.phpw in C:path1filename2.phpOn my other computer, exactly the same code works with no problem - the message is NOT shown.

Posted: 04-19-2011, 07:23 AM

View 9 Replies!   View Related
Access Server Database Using Command Prompt?
In cpanel i create one database and using mysql remote access option in cpanel i create one host. so now how can i access this database in command prompt.I try something like this>> mysql -h hostname - u username -pand enter password and i got the error something like this can not connect server using password yes..I can't connect with the server. my password and username is correct As i verify it using cpanelso any changes require in cpanel or i am doing something wrong here....

Posted: 03-07-2009, 12:36 AM

View 2 Replies!   View Related
Passing $_GET In Linux Command Prompt?
Say we usually access via [URL]command prompt?php -e index.phpBut what about passing the $_GET variables? Maybe something like php -e index.php --a 1 --b 2 --c 3? Doubt that'll work.

Posted: Nov 15 10 at 16:18

View 3 Replies!   View Related
Set A Session Variable Through Linux Command Prompt?
How to set a PHP session variable through linux command prompt?

Clarification So, as you know we can set session variables in PHP using $_SESSION global variable when coding. I would like to know if there is a way to set this variable through php command prompt?

For example, in the code, if I can set $_SESSION['temp'] = "whatever"

Is there a way to set the same variable through command prompt PHP?

Posted: Jan 2 at 0:18

View 2 Replies!   View Related
Script Running Under Command Prompt Or Browser Or Some Other Application?
I just out of curiosity want to know how top detect the client side
application under which the script is getting run. I mean to ask the
how to know whether the script is running under Command Prompt or
Browser or some other application?

Posted: Wed, 28 Nov 2007 05:34:52 UT

View 25 Replies!   View Related
Navigate Password Prompt That's Going To Follow Issued Su/sudo Command?
Since hearing about __HALT_COMPILER in PHP, I've been doing some experimentation with a single-file PHP installers (scripts containing a compressed archive of a filetree for a webapp). It seems to be easy enough to generate a script that contains both the archive and the logic for unpacking it and taking care of configuration. But permissions/user related issues seem to be a bit more thorny. It's highly likely (except in suexec/CGI cases) the PHP process is running as whatever user the webserver runs as, and so it likely doesn't have permissions to write in whatever directory it's running in. I suppose this issue can be skirted if the user knows how to temporarily change the permissions of the directory targeted for the install, but part of the idea behind single-file installs is to simplify what the user has to do, so I don't like this much.

More important, though, once the install is done, it seems to me the files and subdirectories are going to be owned by the webserver user, and they'll therefore be unmanageable by the user (except via more web scripts). I've thought a little bit about trying to use su or sudo to fix this. However, I'm not sure how to navigate the password prompt that's going to follow an issued su/sudo command. It's my understanding sudo also may be limited to a subset of users. Is there a good way to create PHP installer scripts which write files that have user-tinkering-friendly ownership and permissions?

Posted: Mar 30 at 23:27

View 1 Replies!   View Related
Two Javascript Questions About (a) Forms And (b) Prompt Windows?
I have two questions about Javascript:How can I prevent my fields from being cleared when I try to cancel a form submission by returning false in the onsubmit function?

I have a form, which has the onsubmit value "return validate()". If validate() finds an error in the fields, it returns false, which should stop the form submission. It does, but all my fields get cleared, and the browser ignores the Javascript I run before the return statement, like document.write. Example:

function validate() {
//If there's an error:
document.write("Error!");
return false; }

How can I prevent this?Can I have a form inside a prompt window (a popup)?I have not only failed to put several inputs in one Javascript prompt(), but also to put a submittable form inside a prompt window. I have a feeling that this is not possible with Javascript, and would like to know how to achieve this.

Posted: Jul 14 at 19:28

View 2 Replies!   View Related
Slow Command Line Performance?
I have a simple PHP app that prints 'hello world'. When I run it from the command line it takes 6 seconds. Is this normal? It seems to take 1 seconds before "hello world" prints, then 5 seconds after.I am running PHP version 5.2.12 on Windows Server 2008 R2. Could this be an install issue, or is it typical? I did a manual install of PHP then added whatever components were needed to run Drupal. The only PHP addon I remember adding was MDB2, CGI support is there too.

I am used to a Lua project I run from the command line, hundreds of lines of code that will run in under a second.I have some unit tests I run from the command line, and already with just a few they are very slow. I run them from Netbeans and the tests are still very slow. I run precisely this:

C: emp>copy con test.php
<?php
print('hello, world'); [code].....

Posted: Mar 27 10 at 6:24

View 2 Replies!   View Related
Run Phpunit Command In Windows Command Line?
all examples of phpunit I saw run the simple command line tool:phpunit TestClass
but when I try the same on a directory other than the xampp php dir, I end up getting an "unknown command."Is there a way to execute the phpunit command from any directory in the Windows command line?

Posted: Feb 2 10 at 6:45

View 1 Replies!   View Related
Java - Executing .jar File Through Cmd Prompt And Capturing Output?
I have a jar file of my application which has more than one class. The jar file is called by PHP through the command prompt. I am using the following PHP snippet to call the jar file.

<?php
$result=popen('java -jar D:\Development\Filehandler\dist\Filehandler.jar getConfigLang', "r");
while(!feof($result)){
print fread($result, 1024);
flush();
}
fclose($result);
?>

The problem here is interesting. I am able to get the 'System.out.println' statements which are in the main function. But unable to get the output statements from other classes.

I have tried with exec() also. The .jar is working fine and when called from the command prompt directly, its working fine.

Is there a way to capture the whole output?

Posted: Jul 16 10 at 4:44

View 1 Replies!   View Related
Drupal Is Working Very Slow On Windows Xp Localhost?
I installed drupal on my machine which is running WAMPserver latest one with PHP 5.3.54, but after installation it is running very slow.Is there any tweaks which need to be done to make it fast?? I tried joomla and it is working very fast, I dont know what is wrong with Drupal. My drupal version is 6.x-1.2 and I am using drupal-commons from acquia

Posted: Jan 24 at 11:02

View 2 Replies!   View Related
Get Output From Shell_exec Command As Command Runs?
I am coding a PHP-scripted web page that is intended to accept the filename of a JFFS2 image which was previously uploaded to the server. The script is to then re-flash a partition on the server with the image, and output the results. I had been using this:

$tmp = shell_exec("update_flash -v " . $filename . " 4 2>&1");
echo '<h3>' . $tmp . '</h3>';
[code]....

Posted: Dec 7 10 at 13:26

View 4 Replies!   View Related
Write A Php Cli Password Prompt That Hides The Password In Windows?
I have spent several hours trying to find a means of writing a cross platform password prompt in php that hides the password that is input by the user. While this is easily accomplished in Unix environments through the use of stty -echo, I have tried various means of passthru() and system() calls to make windows do the same thing to no avail.I have tried:

passthru('set /p pass=Password: ');
system('echo %pass% > out.txt');
$pass = file_get_contents('out.txt', 'r');

Posted: Nov 18 08 at 4:21

View 3 Replies!   View Related
PHP Running Exec() Windows Program Very Slow In Comparison To UNIX Equivalent Program
Does anyone have an explanation or solution for the following.
I have a PHP script that uses exec() to call a program to do certain
calculations.

The UNIX version of this program I call runs in about 4 to 5 seconds.
When I run the same PHP script using exec() to call the Windows equivalent
of this same program on my Windows desktop, it takes about 32 seconds....

Posted: Tue, 05 Feb 2008 10:08:19 UT

View 6 Replies!   View Related
Copy Command Available In Windows?
Is the copy command available for use on a windows system. I have tried to run a script using it (taken directly out of a PHP manual) and am receiving a "parse error".

Posted: October 26th, 2001, 03:32 PM

View 2 Replies!   View Related
[windows] PHP.GTK And Popuped Command Line
i compile php.gtk file with roadsend php compiler. Is here possiblity to
have windows program without starting command line window?

Posted: December 13th, 2005 10:55 PM

View 1 Replies!   View Related
Windows Program Command Exists
I can do this so easily in Unix: PHP Code:

$msg = exec('whatis convert 2>&1');
echo $msg;

However, in Windows using MS-DOS, I'm utterly lost. I am having to find out if ImageMagick is installed on a system for a function to operate (ImageMagick is required), and since this is a portable web application, you simply can't install ImageMagick everywhere you go.

Therefore I need to know if the system home has ImageMagick or not, and in Unix, I simply do a "whatis convert" and I can tell, but since MS-DOS has no equivalent to "whatis" I can't figure it out, and just running the "convert" command within a recursive function onto thousands of images is just not a good idea.

Posted: 08-30-2005, 05:32 PM

View 12 Replies!   View Related
Can't Run Pear Command After Installation On Windows?
I'm using XAMPP on my WINDOWS/XP local machine. Here are my installation steps:

Running xamppphpgo-pear.bat
I choose, "SYSTEM WIDE" by entering "system"
Continued with "default" individual locations (Pressing "Enter")
Then, double clicked "PEAR_ENV.reg"

After install, while i call "pear" from Command Prompt, it is showing: 'pear' is not recognized as an internal or external command, operable program or batch file.

Here are my "System Environment Variables" and i got all files (and "PEAR" folder) correctly:

PHP_PEAR_BIN_DIR = C:Program Filesxamppphp
PHP_PEAR_DATA_DIR = C:Program Filesxamppphpdata
PHP_PEAR_DOC_DIR = C:Program Filesxamppphpdocs
PHP_PEAR_INSTALL_DIR = C:Program Filesxamppphppear
PHP_PEAR_PHP_BIN = C:Program Filesxamppphp.php.exe
PHP_PEAR_SYSCONF_DIR = C:Program Filesxamppphp...............

Posted: May 20 at 0:33

View 1 Replies!   View Related
Different Between Windows Cmd And PHP Exec() To Execute Command?
In my previous question.I had asked how to execute an external program [ fastcopy ] command line.But I found that the same command will work different in windows cmd mode and php exec().When I am running in windows cmd mode.The target program window was launched and did the job as it would. E.g: I am going copy several files to different removable disk and the program [ fastcopy ] could determine that if the same destination it will wait until the prev file was finished copy.In another words.If the files which will copy to the same destination would copied one by one , at the same time it copies other files to other destinations.But in PHP exec() command. The PHP will do the job behind for you,the program [ fastcopy window ] does't launch and lose the ability to copy to different destination at the same time.So, I just need some advices to make it clear why these happen?

Posted: Jan 21 at 3:48

View 2 Replies!   View Related
Running PHP Scripts From The Command Line Under Windows
I was wondering if anyone has ever tried running PHP scripts from the DOS command prompt. Any insight would be appreciated.

Posted: May 23rd, 2001, 04:44 PM

View 5 Replies!   View Related
Running A Windows Command Line From A Web Page
I have a web page on an intranet, i need to run a command in the local windows run from the webpage. for example when you press a button button on a webpage it has the same effect as running cmd from the run prompt on the local machine. Anyone know how to do this?

Posted: July 09, 2007, 05:41:05 AM

View 1 Replies!   View Related
Sending Commands To Windows Command Line (cmd)
What I want to do is send:

run_app.exe -param 'test' -name 'tester'

to a windows cmd line from PHP.

Is this possible or do I need to write a windows service that is somehow triggered by the application?

Posted: Dec 15 10 at 13:04

View 4 Replies!   View Related
Windows - Launch A File Using Command Line
Specifically I'm looking at Symphony and I'm running through this page. It suggests that I launch a file using command line.

OS: Windows Visa 32

Posted: Jun 28 at 19:47

View 4 Replies!   View Related
Exec(): Quoting Full Command In Windows?
I've written a web application that makes use of exec() in order to run an external program. The program path is configurable and can be expected to have spaces on its name. As we all know, the Windows command prompt accepts spaces in file names or parameteres, you just have to double quote them:

C:>C:Archivos de programaGraphicsMagick-1.3.12-Q16gm.exe
"C:Archivos" no se reconoce como un comando interno o externo,
programa o archivo por lotes ejecutable.
C:>"C:Archivos de programaGraphicsMagick-1.3.12-Q16gm.exe"
GraphicsMagick 1.3.12 2010-03-08 Q16 http://www.GraphicsMagick.org/

So far so good. The issue I'm facing is the usage of the exec() PHP function itself. Certain Windows servers require that you enclose the full command (program + arguments) in double quotes:

exec('""C:Archivos de programaGraphicsMagick-1.3.12-Q16gm.exe" version"'); and other Windows servers require not to use double quotes:

exec('"C:Archivos de programaGraphicsMagick-1.3.12-Q16gm.exe" version');

I can read the PHP_OS constant to detect whether the server runs Windows but I don't know what's the rule behind the quotes or not quotes subject. It if's explained in the PHP manual I cannot find it.

Is is possible to determine programmatically if quotes are needed so I don't need to configure manually each instance of the application? Update #1: I was being misunderstood so I've reworded parts of the question to make it more clear.

Update #2: I found a comment in the PHP manual that explains the exact reason why extra quotes are needed (PHP issues an internal call to cmd /c). I still don't know why this appears to be true or false depending on the system.

Posted: Nov 23 10 at 10:39

View 1 Replies!   View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved