[UPHPU] Running linux commands in php

keith at setuplinux.com keith at setuplinux.com
Wed Oct 13 13:02:59 MDT 2004


There are a bunch of different commands to execute linux command inside of
PHP.  It depends on if you want to return the results as a varialble, just
get the last line of the executed program, or run it in the background.

Take a look here:

http://us2.php.net/manual/en/ref.exec.php



> I am trying to run a linux command in php on a new install and doesn't
> want
> to seem to do it any ideas?
>
> if ($newMac == -1)
> {
>  // bind new mac address here
>
> $query = "update user set mac='$mac', last_access='$newDate' where
> user_name='$uname' and password='$upass'";
> $result = mysql_query($query) or die ("COULD NOT BIND MAC!");
> $query = "insert into bind_log values('$uname','$mac','$newDate')";
> $result = mysql_query($query) or die ("Unable to bind in bind log");
> /* these are the lines with problems
> `/usr/bin/sudo /usr/sbin/iptables -I FORWARD 1 -m mac --mac-source $mac -j
> ACCEPT`;
> `/usr/bin/sudo /usr/sbin/iptables -t nat -I PREROUTING 1 -m mac
> --mac-source
> $mac -j ACCEPT`;
> $forward = $login_success_page;
> }
>
> I have them working on another server jtsu fine but I setup a new server
> and
> now these 2 commands don't work out of the php code.
>
> Brent Wilkinson
> Tech Manager
> Air2Data
> (866)-779-8585
> (801)-510-7474
>
>
>
> _______________________________________________
>
> UPHPU mailing list
> UPHPU at uphpu.org
> http://uphpu.org/mailman/listinfo/uphpu
>
> Sponsored by hostinginferno.com!
>




More information about the UPHPU mailing list