LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-06-2008, 07:42 AM   #1
schris403
LQ Newbie
 
Registered: Aug 2007
Posts: 5

Rep: Reputation: 0
Changing an IP address via php?


Does anyone know if it is possible to change an IP address on a system via php? I have been trying different things for days and can't seem to get it to work. I know I can call ifconfig via php via system("ifconfig"); and I have safe mode turned off to make this work. I will eventually put a safe_mode_exec_dir in my php.ini with ifconfig in there but really could use some help writing this first... Basically I want a page where it will first read the current IP values (ip address, netmask, gateway, dns servers), populate the fields where I can change them and then submit the changes back via ifconfig & route commands.

Any help would be GREATLY appreciated.

Thanks!
Chris
 
Old 11-06-2008, 08:56 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,553

Rep: Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946
Quote:
Originally Posted by schris403 View Post
Does anyone know if it is possible to change an IP address on a system via php? I have been trying different things for days and can't seem to get it to work. I know I can call ifconfig via php via system("ifconfig"); and I have safe mode turned off to make this work. I will eventually put a safe_mode_exec_dir in my php.ini with ifconfig in there but really could use some help writing this first... Basically I want a page where it will first read the current IP values (ip address, netmask, gateway, dns servers), populate the fields where I can change them and then submit the changes back via ifconfig & route commands.
So you know how to do it, via the system() call....what are you having problems with? Parse out the ifconfig first, to pull out the values you stated above, then parse out the results of /etc/resolv.conf and netstat -nr, to build your page. String-substitution later on, so your edited values will be written back...

Last edited by TB0ne; 11-06-2008 at 08:57 AM.
 
Old 11-06-2008, 12:24 PM   #3
schris403
LQ Newbie
 
Registered: Aug 2007
Posts: 5

Original Poster
Rep: Reputation: 0
I'm having problems with parsing the data, I think I'm gettting it into php but am not sure.. I'm not really well versed in php so am just really guessing at things and researching a ton to get it to work. What whould I use to parse the data?

Thanks!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
changing IP address hegdeshashi Linux - Networking 1 01-04-2006 12:16 AM
ip address keeps changing barrys Mandriva 2 12-06-2003 02:52 PM
changing IP address ethanchic *BSD 7 04-25-2003 11:48 PM
Changing the ip address saravanan1979 Linux - Software 1 01-28-2002 04:19 AM
Changing IP address harry Linux - Networking 1 05-29-2001 01:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:52 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration