Re: Configuring interfaces through php
| From: | Nathan Nobbe | Date: | Wed, 24 Dec 2008 07:51:42 +0000 |
| Subject: | Re: Configuring interfaces through php | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-285030@lists.php.net to get a copy of this message | ||
On Wed, Dec 24, 2008 at 12:36 AM, Heysem Kaya
<heysem.kaya@corelink.com.tr>wrote:
> Hi Nathan,
>
> Thanks for your response. Is there such a way to reconfigure the interface
> IP,dns and gateway as well?
>
please keep responses on-list, so that others may benefit.
yes, you can do anything (almost?) you can on the cli w/ those exec family
of calls. so, basic *nix stuff, sprinkled w/ some php if you want to have
more dynamic code..
...
$ifconfigUpOutput = shell_exec("/sbin/ifconfig $interface netmask $netmask
broadcast $broadcast up");
$defaultRoute = shell_exec("route add default gw $defaultGw");
file_put_contents('/etc/resolv.conf', $nameserList);
...
something to that effect. just bear in mind what could happen if network
connectivity doesnt come back up, etc, etc.
-nathan