Possibility to manage Layer 2 Switch ports with PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Pethlehemm
Forum Newbie
Posts: 2
Joined: Mon Nov 03, 2008 3:03 pm

Possibility to manage Layer 2 Switch ports with PHP

Post by Pethlehemm »

I'm not sure that this goes to right place but I try nevertheless.

What I would like to know is that, is it possible to control Layer 2 Switch ports using PHP through SNMPv2? The idea is to turn ports on/off through web application. Like I said, I am not even sure that this is possible but any idea would be welcomed.
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Re: Possibility to manage Layer 2 Switch ports with PHP

Post by infolock »

Think about this way: if you can do it in terminal mode on the server where PHP is installed, then yes.

Are there build-in PHP functions to manage a router? no.

Concrete Answer: Do it on the terminal, then use backticks (`) or shell_exec to issue the connection/commands.
Pethlehemm
Forum Newbie
Posts: 2
Joined: Mon Nov 03, 2008 3:03 pm

Re: Possibility to manage Layer 2 Switch ports with PHP

Post by Pethlehemm »

OK. But this isn't actually a web application, is it? Like I understand, there is no way to create layer2 switch controller using only PHP and which works through web? Can anyone say what are other possibilities?
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Re: Possibility to manage Layer 2 Switch ports with PHP

Post by infolock »

I'm not sure what else you want. If you can issue a command via terminal, you can issue it with PHP. And that means you can either make this a command line php utility or turn it into a web-based application.
Post Reply