Alright, heres what I want to do. I want a page, that will have a button on it. When this button is clicked it will run the system("update.cmd") command. I've tried creating this myself a couple times but I can't make it work. Any input or examples of code that would do what I want would be most helpful.are you tring to return the output?if so,look into using shell_exec();
<!-- m --><a class="postlink" href="http://ca2.php.net/manual/en/function.shell-exec.phpWell">http://ca2.php.net/manual/en/function.s ... ec.phpWell</a><!-- m -->, it must be a problem or a difference with my setup on my home machine vs my setup here.
I uploaded this file.
<?php
$command = "ping 192.168.0.2";
$output = shell_exec("$command");
echo(nl2br($output));
?>
Both here at my home PC <!-- m --><a class="postlink" href="http://67.39.134.84/ping1.php">http://67.39.134.84/ping1.php</a><!-- m -->
and here at work. <!-- m --><a class="postlink" href="http://www.e-hps.net/histedt/ping1.php">http://www.e-hps.net/histedt/ping1.php</a><!-- m -->
If you clicked on the links you will see the file works fine at home but not here.
The machine at home is windows 2000 advanced server.
The machine here is windows 2003
Anyone have an idea of why it's giving me the error?try exec() too
it may be that your host has disabled that function.
it also looks like your host has it setup as a cgi module instead of isapi. what IP are you trying to ping on the host?I am the administrator of both of these machines, so I can make any neccessary changes to the setup, I just don't know what it is that needs to be changed or where to do it.
What do you mean by the cgi module instead of the isapi? On the one that works I'm pinging my workstation on my internal network at home.
On the one that doesn't work I changed the IP address to 10.1.1.1, which is my gateway here at work.well look in your phpinfo() page and on the first part it should say isapi or it will say cgi.
also look in your logs to see if it errored out.alright, i just copied my php.ini file over from home to here at work, it still isn't working. It looks like my home PC is also setup with cgi.
phpinfo from home <!-- m --><a class="postlink" href="http://67.39.134.84/phpinfo.php">http://67.39.134.84/phpinfo.php</a><!-- m -->
phpinfo from here <!-- m --><a class="postlink" href="http://e-hps.net/phpinfo.phpwoops">http://e-hps.net/phpinfo.phpwoops</a><!-- m -->, that didn't work for here
fixed link
<!-- m --><a class="postlink" href="http://www.e-hps.net/phpinfo.phpsee">http://www.e-hps.net/phpinfo.phpsee</a><!-- m --> hwere is says this
CGI/FastCGI
that is cgi mode. now run this on your local machine and see what the differences are. I know you can't run shell_exec in safe mode but you are not in safemode. also look in the php.ini file and see if shell_exec is disabled.
have you tried passthru()http://67.39.134.84/phpinfo.php that is phpinfo for the machine that can run the sys_exec command without a problem
<!-- m --><a class="postlink" href="http://www.e-hps.net/phpinfo.php">http://www.e-hps.net/phpinfo.php</a><!-- m --> is the machine that cannot.
the only difference I see is that the one that works is running IIS5 and the one that doesn't work is running IIS 6
Could that be causing the problem?not sure but you also have 2 different version of php. one is 4.3.1 and the other is 4.3.4 it may be the difference too. did you check the php.ini files to see if shell_exec is in there and if ti is disabled? also I don't see it as a bug. hmm got me, try the other suggestions and see if you get a result. also did you check your error log?
<!-- m --><a class="postlink" href="http://ca2.php.net/manual/en/function.shell-exec.phpWell">http://ca2.php.net/manual/en/function.s ... ec.phpWell</a><!-- m -->, it must be a problem or a difference with my setup on my home machine vs my setup here.
I uploaded this file.
<?php
$command = "ping 192.168.0.2";
$output = shell_exec("$command");
echo(nl2br($output));
?>
Both here at my home PC <!-- m --><a class="postlink" href="http://67.39.134.84/ping1.php">http://67.39.134.84/ping1.php</a><!-- m -->
and here at work. <!-- m --><a class="postlink" href="http://www.e-hps.net/histedt/ping1.php">http://www.e-hps.net/histedt/ping1.php</a><!-- m -->
If you clicked on the links you will see the file works fine at home but not here.
The machine at home is windows 2000 advanced server.
The machine here is windows 2003
Anyone have an idea of why it's giving me the error?try exec() too
it may be that your host has disabled that function.
it also looks like your host has it setup as a cgi module instead of isapi. what IP are you trying to ping on the host?I am the administrator of both of these machines, so I can make any neccessary changes to the setup, I just don't know what it is that needs to be changed or where to do it.
What do you mean by the cgi module instead of the isapi? On the one that works I'm pinging my workstation on my internal network at home.
On the one that doesn't work I changed the IP address to 10.1.1.1, which is my gateway here at work.well look in your phpinfo() page and on the first part it should say isapi or it will say cgi.
also look in your logs to see if it errored out.alright, i just copied my php.ini file over from home to here at work, it still isn't working. It looks like my home PC is also setup with cgi.
phpinfo from home <!-- m --><a class="postlink" href="http://67.39.134.84/phpinfo.php">http://67.39.134.84/phpinfo.php</a><!-- m -->
phpinfo from here <!-- m --><a class="postlink" href="http://e-hps.net/phpinfo.phpwoops">http://e-hps.net/phpinfo.phpwoops</a><!-- m -->, that didn't work for here
fixed link
<!-- m --><a class="postlink" href="http://www.e-hps.net/phpinfo.phpsee">http://www.e-hps.net/phpinfo.phpsee</a><!-- m --> hwere is says this
CGI/FastCGI
that is cgi mode. now run this on your local machine and see what the differences are. I know you can't run shell_exec in safe mode but you are not in safemode. also look in the php.ini file and see if shell_exec is disabled.
have you tried passthru()http://67.39.134.84/phpinfo.php that is phpinfo for the machine that can run the sys_exec command without a problem
<!-- m --><a class="postlink" href="http://www.e-hps.net/phpinfo.php">http://www.e-hps.net/phpinfo.php</a><!-- m --> is the machine that cannot.
the only difference I see is that the one that works is running IIS5 and the one that doesn't work is running IIS 6
Could that be causing the problem?not sure but you also have 2 different version of php. one is 4.3.1 and the other is 4.3.4 it may be the difference too. did you check the php.ini files to see if shell_exec is in there and if ti is disabled? also I don't see it as a bug. hmm got me, try the other suggestions and see if you get a result. also did you check your error log?