Execute shell script
Posted: Mon Oct 30, 2006 9:54 am
feyd | Please use
Any help would be much appreciated.
Regards,
Seab Bracken
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi,
I'm trying to execute a shell script from PHP.
The script has read/write and run properties granted to anyone. It works when run from the shell, but I can't seem to get PHP to run it.
The first part of the program creates the script and it all works fine. It's the last line that won't work
Can anybody spot where I'm going wrong?Code: Select all
<?php
$nas=$_POST['nas'];
$ssid=$_POST['ssid'];
$url=$_POST['url'];
$login=$_POST['login'];
$nvram ="write.sh";
$fp =fopen($nvram, "w");
$script="
cp nvrambak.bin swarmnvram.bin
rpl horn1 $nas swarmnvram.bin
rpl topup.ie topup.ie,$login swarmnvram.bin
rpl swarmspot $ssid swarmnvram.bin
rpl jolly.php $url swarmnvram.bin";
fputs($fp, $script);
system("./sh write.sh");
?>Regards,
Seab Bracken
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]