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


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





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!




View Complete Forum Thread with Replies

Related Forum Messages:
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?) .

View Replies !
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.

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

View Replies !
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.

View Replies !
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.

View Replies !
Return Same Data From Executable To Php As In Command Prompt
I've been trying to use passthru() exec() and system() to execute Apache's htdbm.exe (htaccess user database) and to get some info returned. For example I have tried as a test to htdbm -l .htpasswd, this to return the users in the databaase. None of the functions return the
users in the database while the same string does do this in command prompt. I know there is nothing wrong with the string because when I replace some vars at the end I can add users to the database with php, now it does return a message that this has been done. Al I want is that the same thing that is being returned in command prompt is also returned to PHP.

View Replies !
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?

View Replies !
Better Exec() Command
I work in a network support office which uses a web form to receive
network related problem reports from our end users. The web server is
IIS 5.0 on win2k server, and we use PHP and MySQL to handle the form
and tracking.

I'd like this setup to launch an mp3 player on the web server when a
problem report is sent in. I've tried exec("little mp3 player i
wrote"), but there are two issues with it:

1) I think the mp3 player runs as the user who sends in the report.
If the report is sent from the web server itself, everything works
fine. Otherwise, the mp3 player runs in the background and can't be
shut off.

2) The script waits for the mp3 player to be closed to finish.

I'm guessing there's a different command that will solve problem 2,
but I'm stumped on problem 1. It's more of an IIS/windows issue,
probably,

View Replies !
Problem With Exec Command
I'm having a problem with the exec command. Well, my application has a text to speech converter.it is working fine when i try to run it through command prompt. it is successfully converting the text file to audio file(mp3). but when i'm trying to convert through my application using exec command it
is unable to execute the command.

can you please tell me the reason why it couldn't. are there
any permission issues as far as exec concern.

i tested it on the live server using remote desktop connection.

My Server Configuration is:

OS : windows 2003 standard edition 64 bit.
web server: iis6
php version: 5.1.4

safe_mode is off in the php.ini file
given write permissions to the site (the converted file will be
created in the site folder only)

View Replies !
Just One Line ! (exec Command)
I would most like to just get the first line from exec result. The last line just isn't what I want. When I use passthru it doesn't allow me to store the results in a variable, so that's no good.

View Replies !
Exec() Command Not Functioning In Php
I have the following HTML code, which executes a PHP script.
==================================================
<!--HTML CODE-->
<html><head><title>Vulneraility Scan</title></head>

<body><form method="POST" action="n2.php">
Host<input name="address" type="text" value="IP Address">
<input type="submit" name="Submit" value="SCAN">
</form></body>
</html>
<!--END OF HTML CODE-->
==================================================
The PHP script is
==================================================
<?php
$ip = $_POST['address'];
$com2="echo $ip > targets.txt";
exec($com2);

$com3="rm -rf
results.html";
exec($com3);
echo "<br>This May Take Time";
$com4="nessus -q -T html localhost 1241 j1 abcd targets.txt
results.html";
exec($com4);
echo "<br>Finished";
?>
==================================================
I only see "This May Take Time " and "Finished" words on the screen,
the exec() commands do not execute.

View Replies !
Exec() Command Doesn't Do Anything
on my linux-mysql-php3 system the exec() command doesn't do anything. I think I have permissions right and according to /usr/local/lib/php3.ini is oho not running in save mode.

View Replies !
Simple Php Exec Command
I have made a php script that at first loads rtorrent in a bash file which starts and boots up a torrent. Well for some reason it worked on my Gentoox (xbox linux) but not any of the other linux os I tried from Fedora core 4 and centos 3. Now I moved on to ctorrent and I run the same thing and it loads the torrent from what I see on the tracker but it does not upload. What is crazy is if I use ssh and run the bash script it boots up fine. let me show you what I'm saying. Code:

View Replies !
PHP Command Line Called Via Exec();
If I enter the following at the command line, I
successfully get an email sent to the correct name/email:

php /var/www/html/admin/adminscripts/welcome-cli.php
'Me' 'me@me.net' ....

View Replies !
Exec Command Doesn't Work
I'm trying to create a script which my cron will run once a day to backup my MySQL database, but the exec command doesn't want to work no matter what I try...

exec("mysqldump -h localhost -u user -p pass --opt DataBase > BACKUPS/backup.mysql") or die("Problem");

I have tried adding the full path to mysqldump, I have tried using my root access, I have tried using a different dir to store the files, changed permissions all sorts and nothing works. It always returns "Problem" and if I take out the or die then it just returns a blank screen. I also tried system () and that gave the same results.

View Replies !
Command Window - Exec/system
I'm in the process of developing a script in Windows where I need to use exec/system. Whenever I execute either, Windows spawns a command window which automatically sappears. Is there a clean way to force Windows to NOT display the command window?

I've seen this discussed a few times previously, but, none of the
solutions seem to be working (tried both exec and system; tried using
cmd /c, tried using start /B, etc.)



View Replies !
ProgressBar For A Shell Exec Command
I am executing a shell command through php

$command = "some mathematical calculations":

$output = exec($command);

The $output takes approximately 10 - 40 sec for its execution every time. I wanted to show a progress bar proportionate to the time of execution. Code:

View Replies !
Folder Zip - Execute Unix Zip Command Exec()
1.Any one knows How to Zip the folder using php.

2.How execute unix zip Command exec() function.

View Replies !
How Do You Do TCL Exec Command On PHP Script That Uses User Input?
The TCL command I am using will do a command-line action on a PHP
script:

set cannotRunPHP [catch {
eval "exec php -q $root/scripts/info/php/info.php"
} errMsg]

I have to do it this way as both the TCL script and the PHP script run
as CLI. However, "info.php" requires user input to run; this causes
the TCL script calling the PHP script to hose up and die.

Is there a way I can do this so that the TCL script can call the PHP
script without any problems? Is there an alternate way of calling the
PHP script other than using exec were that to solve this issue?



View Replies !
GLOBAL OBJECT IN EXEC COMMAND CALL
I have an object:

$special = new special;

Let's say I have a function:

class special {
function outputtext() {
return "test";
}}

now let's say I want to use the exec command to output that text:

exec("/usr/local/bin/php -r 'echo
$special->outputtext();'",$returnarray,$returnvar);

I get an error call to a member function on a non-object. Any ideas how to pass teh GLOBAL OBJECT var into the shell exec command? I am haivng a terrible time figuring out what to do.

View Replies !
Exec Command Executing The Program In The Background
i am running xampp on my computer from apachefriends.org, it's a apache server

this is the php script

<html>
<head>
<?php

exec ('notepad');
?>
</head>
</html>

but when i execute the php script on my computer , notepad doesnt not run

i used a process viewer and discovered that notepad is running in the background and i cannot see it

does anyone know how NOT to make it run in the background? i wan to see the notepad window on the apache server (my computer)

View Replies !
Passing Parameter In Command Line
Can somebody tell me how can I pass a parameter to a PHP script in de command line?
for instance: bin]# ./print_listname 18

<?php
//$list_number = // parameter var;
echo $list_number;?>

View Replies !
Cli - Passing A String Via The Command Line
Ancient old crusty decided to try PHP a week or so ago. Signed up with a provider who offer PHP. Bought book. Mastering PHP.. first few pages give example of passing a string via the command line. Code:

View Replies !
Passing $_POST Variables To Command Line Php
I'm trying to test some php script using the command line php.exe. Is there any way to pass the $_POST variables? I know how to pass the $_GET variables, but I don't know how to do this for the $_POST ones.

View Replies !
Passing $_GET, $_POST Variables To Command Line Php
I'm trying to test some cgi php, but do not have access to a webserver (in
any way, shape, or form). I've been trying to fudge testing by using the
CLI php.exe in the windows distribution.

I've read all the faqs about the CLI and I'm not sure if there is any way to
pass the $_GET and $_POST variables. I have yet to find any information on
this topic online, either.

If anyone has any ideas of how to do this or a better way to test, please
let me know.

View Replies !
Wait $x Seconds, Or Wait Until The "exec" Command Is Finished?
I'm working on a script that will dump a MySQL database to a file with exec(mysqldump [args]), then will let the user download the database.

The dump may take a few seconds, so I want to user to be forced to wait before downloading the file.

How can I tell my script to wait $x seconds before performing the next step in the script?
Even better, would be the ability to wait until the dump is done. Is this possible with PHP?

View Replies !
Is There Something Like An OR Command?
I have a password section, where people submit their username and password and if valid, they get access. However, I would like only a few people from that database to get access, so I use a third colum called "user_id", and while the script checks for correct username/password is also checks:

View Replies !
Is There A Pwd() Like Command?
i can't find anything that will give me the prsent working directory or the name of the script i'm working within. any ideas?

View Replies !
Php Cli Command ...
Has anyone any idea why this doesn't work ?

while read file ; do php -r 'urlencode($file);' ; done > file

I've also tried

cat file | php -r 'urlencode($0);' > file

no luck there either ?

View Replies !
PHP-CLI And The Less Command
I have a CLI application that produces lots of output to the terminal, so I like to send the output along to the "less" command. This has always worked very nicely. Moving to the top or bottom of the output used to require just hitting the "home" or "end" key, and the up and down arrows as well as page up and page down worked nicely....

View Replies !
If And Where Command
I've got 2 tables... Lets say tableA and tableB I want to do this, but I dont know if it is possible:

<?php if ($x_tableA_FIELD == "green") { ?>

echo "$x_tableB_FIELD1" WHERE $x_tableB_FIELD2 == "green"

<?php } ?>

So I know the if part works... can this WHERE part work? And what would the syntax be?

View Replies !
AVG Command
I have done and redone this code many times. Can anyone help me figure it out?

<?PHP $db = mysql_connect("host", $username, $password);
mysql_select_db("database",$db);
$sql = "SELECT AVG(votes) FROM requested";
$result = mysql_query($sql);
$row = mysql_fetch_array ($result);
echo $row;
?>

View Replies !
This Command
help me with this command below as you can see it has a M in it
M= MEMBER and P= PENDING

i need this command to includ the M and the P 

 <? if($mtype=='M') { ?>

View Replies !
PHP On Exit Command ?
I have a main PHP script with multiple sub-scripts, that are
called on certain events...

Is it possible to create an "on exit" command, to tell me which
sub-script (& line number) a PHP process ended on, if an "exit"
command is encountered?

View Replies !
Command Execution
how do i run "perl /cgi-bin/cool.cgi" from within php file (4.1.0) on win 2000 with IIS.

i know the paths to perl.exe and absolute path to cgi file also. i tried system("perl ......"); and exec(".......") but didn't work.

View Replies !
Running SCP Command
Is it possible for me to use PHP to run SCP? I know that I can use exec() or system() or shell_exec() to run a command, but when running SCP you have to run the command, and then enter a password, so is it possible to do that? If so, how would I do it?

View Replies !
Outputting The /usr/bin/top Command.
The code below will display the server uptime using the uptime command in linux. How would you go about displaying the /usr/bin/top command? i've noticed there are miscellaneous commands in linux relating to performance etc.. is there a way in php just to run a command like uptime and output it in its raw format? PHP Code:

View Replies !
Does The Phpinfo() Command Ever Lie?
I wanted to use the AddType directive in an .htaccess file. So I used
phpinfo() to get the path info for PHP. I found this line:

PATH /bin:/usr/bin

So I tried this, but it did not work:

AddType application/x-php .htm Action application/x-php
/bin:/usr/bin/php
AddType application/x-php .html Action application/x-php
/bin:/usr/bin/php

I also tried this:

AddType application/x-php .htm Action application/x-php /usr/bin/php
AddType application/x-php .html Action application/x-php /usr/bin/php

I also tried this:

AddType application/x-php .htm Action application/x-php /bin:/usr/bin/
AddType application/x-php .html Action application/x-php
/bin:/usr/bin/

I tried a few other variations as well. Nothing.

Then I went looking for a file called "php".

I looked in /bin/ but it wasn't there.

I looked in /usr/bin/, but it wasn't there.

Does it go by another name? Why isn't it where PATH said it would be?

View Replies !
Links By Sql Command.
What I am trying to do is that I would like to know how to make links to take out my datas from my database. Let's say I will make 3 links. One is Name, Second is Country. Third is age. Whenever a user click one of them, it comes out my datas order by that(A-Z) like sql command---> order by name, ****ry, or age. I would like to make three links so that users can choose from these options.

View Replies !
System() Command
if im using this it dont work PHP Code:

View Replies !
Command For Redirecting
What is the command for redirectig in php?

View Replies !
Run From Command Line
I just installed the latest version of PHP as an Apache Module. I'm wondering, how can I now run PHP from the command line? I heard there was a way without having to reinstall PHP to do this.

View Replies !
Php Break Command
I have a while look inside of a for loop and when i use the break command it stops boths loops. I am wondering if there is a way to only have it stop the while look.

View Replies !
The Mail Command
I have apache/php/mysql installed on a win98 machine. When I try to execute the mail command in PHP3 it just doesn't work. any ideas?

View Replies !
Use The Ftp_put Command.
I was trying to use the ftp_put command. It worked for the files in the
same directory as my php file, but if I try to fetch a file somewhere else
on the server with the following syntax for the source file it doesn't work.

"serverdirectory_pathfilename"

also it didn't work with

"//server/directory_path/filename"

What is the correct way to access the file?



View Replies !
INSERT INTO Command
I have a table named Clients with the following fields: Name, Address, Phone. If I do this query:

INSERT INTO Clients (Name, Address, Phone, Email) VALUES ('John Doe', &#391; First St', &#39555;-5555', 'blah@blah.com')

What does this do with the Email field and value since it was not in the table to begin with? Does it add that field automatically? If not, is there a way to add that field? I'm using MS Access with odbc.

View Replies !
COPY Command
Currently, I have a routine with the file command, & a foreach loop to
save the file (append) to another file..

HOWEVER..

I've come accross a situation where one of my 'source' files is over
17 Megs, & my script times out... (im not echoing anything to the
screen / cron jobs...)

QUERY1 :-

I cant see anywhere if the copy command can APPEND to an existing file ?
(or does it just 'copy' - & replace whatevers there ?)

Is there any other way - that I can 'append' files together - without
timing out ?

- PS - im re-running the entire process from the start - (just in
case) - to see if the file is still 17 megs (its compiled from 900-
other files - a summary file)

View Replies !
How To Use Php On The Command Line?
My question is how to use php on command line in windows

View Replies !
Configure Command Vs Php.ini
If the php install is configured with --'without-oci8', is there anyway to
override that using php.ini (eg, 'extension=php_oci8.dll')

View Replies !
Command Line Or Not???
What's the best way to check whether script is run from command line or by
web server?



View Replies !
Execute Ssh Command Via Php?
I'm trying to make a web interface for my music server. Basically what it's going to do is list all the music files in a directory. Then when a song is clicked PHP executes a shell command, for example "sudo play /var/www/music/System Of A Down - BYOB.mp3" and my server plays the song. So far I've been trying system() and exec() but it do doesn’t seem to work.

View Replies !
The 'Dir' Or 'ls' Command
how would i do a ls or dir command in php? So, I want to output to the user exactly what directories and files are in a certain file... What command or code could i use?

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved