
![]() |
nutballs
using
PHPon a LAMP box. The box will haveapacheand DNS, though I have no idea what DNS to use (BIND?).Can someone give me a pointer/example/link to show me how to create a website and associated DNS entries via PHP? I can't seem to figure out the correct thing to search for in the big G.vsloathe
Sorry, I don't have any examples.
I can offer some simple perspective though: Everything in *nix is a file, so theoretically all you need to do is give PHPwrite perms on the file associated with your DNS bindings, and have it write out whatever you need. Word of caution of course, back up your DNS entries before screwing with it, as you could royally mess up the syntax/format of the files and have to start all over. Don't know, I've never done it, but it seems straightforward enough. Best of luck to you.jammaster82
WARNING: I SERIOUSLY DONT KNOW WHAT IM TALKING ABOUT
AT ALL JUST CUTTING MY TEETH SO GRAIN OF SALT HERE... i find my dns name when i do an 'ifconfig -all' from the command line. mine is hr.cox .netDoes this excerpt from http://www. ubuntugeek.com/ubuntu-710-gutsy-gibbon-lamp-server-setup.htmlhelp? Configuring Static ip address in UbuntuserverUbuntuinstaller has configured our system to get itsnetwork settings via DHCP, Now we will change that to a static IP address for this you need to edit Edit /etc/network/interfaces and enter your ip address details (in this example setup I will use the IP address 172.19.0.10):sudo vi /etc /network/interfacesand enter the following save the file and exit # The primary network interfaceauto eth0 iface eth0 inetstaticaddress 172.19.0.10 >net mask 255.255.255.0 >net work 172.19.0.0 broadcast 172.19.0.255 gateway 172.19.0.1 You need to setup manually DNS servers in resolv.conf file when you are not using DHCP. sudo vi /etc/resolv.conf You need to add look something like this search domain.com nameserver xxx.xxx.xxx.xxx nutballs
yea, i figured all of it is files and I just need to edit it. I found the files, i understand the syntax, sort of, now I gotta figure out how to do it... lol
@jam, the ips of the machine are what your talking about which is no problem. This is assigning IPs to websites, which is via the DNS server. thanks though.perkiset
Hey Nuts -
I got tagged by a nasty DDOS against DNS on my boxes years ago (yes, they were spammy) ... named is reasonably easy and the new stuff is supposed to be more robust, but since I got hit I outsource DNS services to my ISP. Here is an example of a config file for named, just in case you want to see another: (this is ancient and no longer in production...) you are correct that it is all file based, but you will need to execute a kill -HUP (hangup) to tell the daemon to reset... this will (OR REALLY SHOULD BE) only doable by root or a process running as root, so you'll want to be careful how you implement that using PHP, because one way or another, that script is going to have access to things that you'll never want anyone else to see.
nutballs
cool that looks like what I am after. the DNS service is called "named"?
under windows I just had an asppage that would be called when a new site was created, and that would run a vbscript file. That file would do the restart. Im sure I can do something similar inlinux. like aperlfile that is not webaccessible, being run by a web page. otherwise, i might just not care anyway, and just let thephpdo it directly, and have security on the page that does it. automation is key![]() perkiset
yes - it's short for name daemon. (named). It is almost always distributed with any *nix. It may not be running by default though.
thedarkness
service named reload
these days Perk, at least under RHish OSs. Zone files are likely to be stored in; /var/named/chroot/var/named/ as named usually runs in a chroot jail (it has a history of buffer overflow problems) my zone files differ slightly from perk's so the old timer's file may be a little out of date ? ![]() Under apacheyou would be looking for the <VirtualHost> section of /etc/httpd/conf/httpd.conf or sometimes a vhosts.conf file in /etc/httpd/conf.d andapachecan be asked to reload it's config using the "service" syntax above.Sing out if you need a hand on this nuts as I have a friend who has a script that does this that I patched for him some time ago, he owes me some favours so I can prolly get a copy. Cheers, td [edit] You also need to look at (and edit) /etc/named.conf [/edit] nutballs
cool td, thanks for the directions. I still have a few days before I take a stab at this. but when i do Im sure I will have some questions.
perkiset
quote author=thedarkness link=topic=808.msg5568#msg5568 date=1204705996 service named reload these days Perk, at least under RHish OSs. Zone files are likely to be stored in; /var/named/chroot/var/named/ as named usually runs in a chroot jail (it has a history of buffer overflow problems) my zone files differ slightly from perk's so the old timer's file may be a little out of date ? ![]() ![]() ![]() ![]() ![]() ![]() Fish you, punk ![]() ![]() ![]() ![]() ![]() thedarkness
Of course I meant no offence by that remark old fella
![]() Cheers, td perkiset
Course not.
![]() I assume... ![]() ![]() arms
i was playing with this a little while, never really followed through but i got a bit familiar with tinydns (which i think is a part of the djbdns package).
after realizing bind's config was conceived by a drunken evil sadist, i tried out tinydns. it's config is much better suited for adding records automatically. found these howtos collecting dust in my bookmarks: http://forums.thepl anet.com/index.php?showtopic=80021http://gentoo-wiki.com/HOWTO_Setup_a_DNS_Server_with_DJBDNS https://store.dwalliance.com/news/view_article.html?article_id=7576a92a47743b7cf5956bd2e4e45539 nutballs
cool i will check out those as well thanks arms
thedarkness
Ahh, D. J. Bernstein. A screaming genius no doubt and the reputation of being a hard ass. I have used qmail for years, keep thinking about changing but can't find a good enough reason. His stuff is 'A' class
My 2c, td |

Thread Categories

![]() |
![]() |
Best of The Cache Home |
![]() |
![]() |
Search The Cache |
- Ajax
- Apache & mod_rewrite
- BlackHat SEO & Web Stuff
- C/++/#, Pascal etc.
- Database Stuff
- General & Non-Technical Discussion
- General programming, learning to code
- Javascript Discussions & Code
- Linux Related
- Mac, iPhone & OS-X Stuff
- Miscellaneous
- MS Windows Related
- PERL & Python Related
- PHP: Questions & Discussion
- PHP: Techniques, Classes & Examples
- Regular Expressions
- Uncategorized Threads