<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Web Development Blog &#187; directadmin</title>
	<atom:link href="http://www.web-development-blog.com/archives/tag/directadmin/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.web-development-blog.com</link>
	<description>Web development tutorials, SEO articles and PHP script resources</description>
	<lastBuildDate>Sun, 25 Jul 2010 14:38:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Start a hosting business with DirectAdmin</title>
		<link>http://www.web-development-blog.com/archives/start-a-hosting-business-with-directadmin/</link>
		<comments>http://www.web-development-blog.com/archives/start-a-hosting-business-with-directadmin/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 07:32:53 +0000</pubDate>
		<dc:creator>Olaf</dc:creator>
				<category><![CDATA[PHP scripts]]></category>
		<category><![CDATA[Web Hosting]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[dedicated server]]></category>
		<category><![CDATA[directadmin]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[socket]]></category>
		<category><![CDATA[vps]]></category>

		<guid isPermaLink="false">http://www.web-development-blog.com/?p=1172</guid>
		<description><![CDATA[There are thousands of hosting companies on the Internet and maybe this article will help you to start your own. Many companies offering web services are hosting reseller of other (bigger) companies or have partnerships with hosting companies. Maybe you have ever thought to offer hosting services by yourself, with a dedicated server or a [...]]]></description>
			<content:encoded><![CDATA[<!--S-ButtonZ 1.1.5 Start--><!--S-ButtonZ 1.1.5 End--><p>There are thousands of hosting companies on the Internet and maybe this article will help you to start your own. Many companies offering web services are hosting reseller of other (bigger) companies or have partnerships with hosting companies. Maybe you have ever thought to offer hosting services by yourself, with a dedicated server or a VPS hosting account, it&#8217;s very easy to offer hosting plans for your existing customers. The following article will show you, using a few examples, how to use a web server installed with the software DirectAdmin to create web hosting accounts using their native API system.</p>
<blockquote><p>Don&#8217;t think it&#8217;s easy to pull a new hosting company from the ground. This market is very saturated and we suggest to start offering hosting services most of all to your existing customers only.</p></blockquote>
<h3>VPS hosting versus dedicated server hosting</h3>
<p>These days it&#8217;s not necessary to have your own dedicated server, a good maintained VPS host is often much more reliable. If the VPS hosting platform is well managed, you don&#8217;t have to worry about the shared memory because the virtualization software is able to manage all the resources. Why do you need a dedicated server if a VPS is so powerful? You need your own server for special hardware configurations or if your provider doesn&#8217;t have a good VPS platform. While many VPS companies using the same machines, the risk of hardware failures is low because hardware replacements should be a peace of cake. A &#8220;special&#8221; dedicated or colocated server might be a serious risk, f.e if the motherboard replacement is not available. <strong>A VPS host is scalable and often much cheaper than a dedicated server.<br />
</strong><span id="more-1172"></span></p>
<h3>Web Server Control Panel</h3>
<p>Using a control panel, makes it easy to create or maintain all the web hosting accounts for your customers. Sure as a Linux expert you don&#8217;t need a CP, but if you core business is web development, a control panel might really help. There are many of them, most of them are commercial products, but there are also a a few open source projects which are available for free. In this blog post we suggest to use <a href="http://www.directadmin.com/" rel="nofollow">DirectAdmin</a>, because this software is easy to use, the license is not very expensive and there is also a very powerful API system.</p>
<h3>Installing DirectAdmin</h3>
<p>After you got your VPS (or dedicated server) you&#8217;re ready to install the server software. Before you start the installation process check these DirectAdmin requirements. Most important is that your Linux server is not pre-installed with software like Apache, MySQL, PHP, FTP&#8230; check this warning from the DA website:</p>
<blockquote><p>***Please do not install services such as Apache, PHP, MySQL, Ftp, Sendmail, etc., as we will do this for you.  All we need is a CLEAN install of your operating system.***<br />
We do not recommend installing DirectAdmin on an existing live production server.<br />
DirectAdmin does not convert existing data upon install. </p></blockquote>
<p>For most DirectAdmin hosts CentOS is the preferred Linux operating system. You need also a DirectAdmin license, ask your VPS hosting provider, he can offer the license for a low fee. </p>
<p><strong>DirectAdmin installation resources:</strong></p>
<ul>
<li><a href="http://www.directadmin.com/install.html" rel="nofollow">Getting Started with DirectAdmin: What kind of server do I need?</a></li>
<li><a href="http://www.directadmin.com/installguide.html" rel="nofollow">DirectAdmin Installation Guide</a></li>
</ul>
<p>The installation process is not part of this article. If you finished the installation part, you should check this <a href="http://www.web-development-blog.com/archives/how-to-setup-the-dns-and-name-server-for-a-directadmin-web-server/">DNS installation guide</a>. </p>
<h3>Creating hosting accounts</h3>
<p>After the final re-boot and your DirectAdmin server is running, you&#8217;re able to setup hosting accounts for your customers. You can create them by yourself using the DA control panel or using the DirectAdmin API within your web application. Think about the following application process:</p>
<ol>
<li>Customer has ordered a hosting accpunt from your website</li>
<li>The payment is cleared and a request is send the API system</li>
<li>Within DirectAdmin a hosting account is created</li>
<li>The customer gets the login and hosting accpunt details via e-mail</li>
</ol>
<p>How far you&#8217;re using this features of DA depends on yourself. The <a href="http://www.directadmin.com/api.html" rel="nofollow">DirectAdmin API</a> is able to manage all functions you need. This way you&#8217;re able to create your own we application, without telling your customers that a control panel is used.</p>
<h3>Access the DirectAdmin API system</h3>
<p>The API documentation is very complete and easy to use even for less experienced developers. There is also a custom PHP class to access the API via a HTTP socket, <a href="http://files.directadmin.com/services/all/httpsocket/httpsocket.php" rel="nofollow">download the code here</a>.</p>
<p>Using this PHP class is very easy, the following code is used to fetch all the user accounts from a reseller/admin account:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">include_once</span> <span style="color: #0000ff;">'httpsocket.php'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$sock</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> HTTPSocket<span style="color: #339933;">;</span>
<span style="color: #000088;">$sock</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'some.server.com'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2222</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #000088;">$sock</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_login</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'login'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'password'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$sock</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/CMD_API_SHOW_USERS'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">parse_str</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sock</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fetch_body</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">print_r</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// shows the result in the browser</span></pre></div></div>

<p>Next we show how-to add a new user to an existing reseller account (the package named &#8220;default&#8221; is a pre-defined hosting package):</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">include_once</span> <span style="color: #0000ff;">'httpsocket.php'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$sock</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> HTTPSocket<span style="color: #339933;">;</span>
<span style="color: #000088;">$sock</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'some.server.com'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2222</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$sock</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_login</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'login'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'password'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$sock</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/CMD_API_ACCOUNT_USER'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
	<span style="color: #0000ff;">'action'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'create'</span><span style="color: #339933;">,</span> 
	<span style="color: #0000ff;">'add'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Submit'</span><span style="color: #339933;">,</span> 
	<span style="color: #0000ff;">'username'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'abcuser'</span><span style="color: #339933;">,</span> 
	<span style="color: #0000ff;">'email'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'mail@domain.com'</span><span style="color: #339933;">,</span> 
	<span style="color: #0000ff;">'passwd'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'123456'</span><span style="color: #339933;">,</span> 
	<span style="color: #0000ff;">'passwd2'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'123456'</span><span style="color: #339933;">,</span> 
	<span style="color: #0000ff;">'domain'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'googles.com'</span><span style="color: #339933;">,</span> 
	<span style="color: #0000ff;">'package'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'default'</span><span style="color: #339933;">,</span> 
	<span style="color: #0000ff;">'ip'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'123.123.123.123'</span><span style="color: #339933;">,</span> 
	<span style="color: #0000ff;">'notify'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'yes'</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">parse_str</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sock</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fetch_body</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">print_r</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// shows the result in the browser</span></pre></div></div>

<p>This API call is the same as creating a user from the web interface:</p>
<p><a href="http://www.web-development-blog.com/wp-content/uploads/2010/07/create_user.png" rel="shadowbox[post-1172];player=img;"><img src="http://www.web-development-blog.com/wp-content/uploads/2010/07/create_user-300x146.png" alt="" title="create_user" width="300" height="146" class="alignnone size-medium wp-image-1180" /></a></p>
<p>If you check all the API functions, you will see that it&#8217;s possible to create a 100% white labeled web application. Even if you don&#8217;t have that kind of web application, it&#8217;s very easy to create hosting accounts using the web interface on your DirectAdmin web server.</p>
<p><strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://www.web-development-blog.com/archives/how-to-setup-the-dns-and-name-server-for-a-directadmin-web-server/" rel="bookmark" title="September 17, 2007">How-to setup the DNS and name server for a DirectAdmin web server</a></li>
<li><a href="http://www.web-development-blog.com/archives/create-custom-website-backups-using-cron/" rel="bookmark" title="October 17, 2009">Create custom website backups using CRON</a></li>
<li><a href="http://www.web-development-blog.com/archives/setting-up-an-internet-shopping-cart/" rel="bookmark" title="November 11, 2007">Setting up an Internet shopping cart</a></li>
</ul>
<p><!-- Similar Posts took 3.810 ms --></p>
<div style="clear:both;">&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.web-development-blog.com/archives/start-a-hosting-business-with-directadmin/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Curl: Location redirect while open_basedir is set</title>
		<link>http://www.web-development-blog.com/archives/curl-follow-url-location-while-open_basedir-is-set/</link>
		<comments>http://www.web-development-blog.com/archives/curl-follow-url-location-while-open_basedir-is-set/#comments</comments>
		<pubDate>Sat, 31 Jan 2009 21:36:21 +0000</pubDate>
		<dc:creator>Olaf</dc:creator>
				<category><![CDATA[PHP scripts]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[directadmin]]></category>
		<category><![CDATA[link check]]></category>
		<category><![CDATA[open_basedir]]></category>

		<guid isPermaLink="false">http://www.web-development-blog.com/?p=222</guid>
		<description><![CDATA[If you need to follow redirects within your php code using Curl and the open_basedir is set you came into some trouble. If you disable this directive all your directories with a 777 permission are not safe (if one or more website on the same server has some security issues). If you don&#8217;t have additional [...]]]></description>
			<content:encoded><![CDATA[<!--S-ButtonZ 1.1.5 Start--><!--S-ButtonZ 1.1.5 End--><p>If you need to follow redirects within your php code using Curl and the open_basedir is set you came into some trouble. If you disable this directive all your directories with a 777 permission are not safe (if one or more website on the same server has some security issues). If you don&#8217;t have additional protections you should NEVER disable the open_basedir directive (at least if you&#8217;re using 3rd party applications).</p>
<h3>A simple link checker</h3>
<p>If you need to check URLs and if you need a script that has to follow possible redirects, you  need to use Curl. The option CURLOPT_FOLLOWLOCATION will follow each redirect until the curl client has reached the target website. This option rocks if you need to check URLs. The following simple snippet will check an URL and returns the HTTP_CODE:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$ch</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_init</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'http://www.domain.com'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_TIMEOUT<span style="color: #339933;">,</span> <span style="color: #cc66cc;">15</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_USERAGENT<span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20041001 Firefox/0.10.1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_HEADER<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_RETURNTRANSFER<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_FOLLOWLOCATION<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_exec</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$info</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_getinfo</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'http_code'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_close</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Running this code with the directive open_basedir is set you get this error: <span id="more-222"></span></p>
<blockquote><p>Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in /home/user/public_html/script.php on line &#8230;</p></blockquote>
<p>What if you can&#8217;t disable this nasty directive and you need this function? There are some alternative functions inside the PHP manual but according other comments on that place those are not perfect solutions.<br />
How about executing this script inside the path used by this directive? The default pathes are on my machine (and many others) &#8220;/tmp&#8221; and &#8220;/usr/local/lib/php/&#8221;. Do you like to execute your scripts in these directories? If not you need add additional directories to your Apache configuration. Since I like DirectAdmin machines I post the code you need to add to your DA user account (Admin Level -&gt; Custom HTTPD Configurations, you need to ask your hosting provider if you don&#8217;t have full access):<br />
<code>|?OPEN_BASEDIR_PATH=`HOME`/:/tmp:/usr/local/lib/php/:/home/superuser/domains/some-domain.com/some_dir/|</code><br />
With this setting your websites user  has access to the directory &#8220;some_dir&#8221;, place your link checker script (link_check.php) there after you made this modifications:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$ch</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_init</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$argv</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_TIMEOUT<span style="color: #339933;">,</span> <span style="color: #cc66cc;">15</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_USERAGENT<span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20041001 Firefox/0.10.1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_HEADER<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_RETURNTRANSFER<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_FOLLOWLOCATION<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_exec</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$info</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_getinfo</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_close</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$valid</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">200</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">302</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">301</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">in_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'http_code'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$valid</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'ok'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>(don&#8217;t forget to add the php tags to this code)<br />
Now inside your web application you can call this script with this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$check</span> <span style="color: #339933;">=</span> <span style="color: #990000;">shell_exec</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/usr/local/bin/php /home/superuser/domains/some-domain.com/some_dir/link_check.php http://domain.com &amp;amp;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$check</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'ok'</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'URL is valid!'</span><span style="color: #339933;">;</span></pre></div></div>

<p>This code works only if safe_mode = off<strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://www.web-development-blog.com/archives/create-custom-backups-from-your-website-using-curl/" rel="bookmark" title="July 30, 2008">Create custom backups from your website using cURL</a></li>
<li><a href="http://www.web-development-blog.com/archives/tutorial-ftp-upload-via-curl/" rel="bookmark" title="October 11, 2007">Tutorial: FTP Upload via cURL</a></li>
<li><a href="http://www.web-development-blog.com/archives/create-custom-recaptcha-images-using-their-api/" rel="bookmark" title="December 7, 2009">Create custom reCAPTCHA images using their API</a></li>
</ul>
<p><!-- Similar Posts took 3.903 ms --></p>
<div style="clear:both;">&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.web-development-blog.com/archives/curl-follow-url-location-while-open_basedir-is-set/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How-to setup the DNS and name server for a DirectAdmin web server</title>
		<link>http://www.web-development-blog.com/archives/how-to-setup-the-dns-and-name-server-for-a-directadmin-web-server/</link>
		<comments>http://www.web-development-blog.com/archives/how-to-setup-the-dns-and-name-server-for-a-directadmin-web-server/#comments</comments>
		<pubDate>Mon, 17 Sep 2007 12:44:47 +0000</pubDate>
		<dc:creator>Olaf</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web Hosting]]></category>
		<category><![CDATA[directadmin]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[panel]]></category>
		<category><![CDATA[setup]]></category>

		<guid isPermaLink="false">http://www.web-development-blog.com/archives/how-to-setup-the-dns-and-name-server-for-a-directadmin-web-server/</guid>
		<description><![CDATA[You have enough of shared hosting and/or the costs for bandwidth are too high? OK, the next step is your own dedicated server, but with a limited budget it&#8217;s hard to find a good and cheap managed server. For all beginning server administrator is this guide about how-to setup the DNS for a server with [...]]]></description>
			<content:encoded><![CDATA[<!--S-ButtonZ 1.1.5 Start--><!--S-ButtonZ 1.1.5 End--><p>You have enough of shared hosting and/or the costs for bandwidth are too high? OK, the next step is your own dedicated server, but with a limited budget it&#8217;s hard to find a good and cheap managed server.</p>
<p>For all beginning server administrator is this guide about how-to setup the DNS for a server with a DirectAdmin control panel.</p>
<p><strong>Why DirectAdmin (DA)?</strong><br />
I like this control panel at most, it&#8217;s fast, frequently updated and there are updates also for the latest PHP and MySQL version. I&#8217;m sure there are much more pros and of course there are more powerful control panel systems.</p>
<p>If you buy an unmanaged dedicated server, the operating system and DirectAdmin should be installed. If not, you need to do it by yourself (check the DA website for further information). I guess this is a hard job for a beginner, if you need to start from the beginning try to use Ubuntu, this Linux distribution works great with DirectAdmin.<span id="more-112"></span></p>
<p>First of all you need to login to your DirectAdmin control panel, click &#8220;IP management&#8221; and enter the two IP addresses (we use the IP addresses 12.34.56.78 and 12.34.56.79 for our example) you got from your hosting provider (the first server IP address should be already in the list)</p>
<p>Next from the admin panel, switch to the &#8220;User level&#8221; and click on &#8220;DNS Management&#8221;. Enter here the DNS records you need for your domain name / host. Don&#8217;t forget you need to enter also the two name server entries (there is a trailing dot (.) behind the value).</p>
<p>To setup the DNS and name servers for your server you need use the domain name you have used in the local DNS setup before. Configure the domain with your &#8220;global&#8221; DNS (domain) provider as follow (these are the two IP addresses you have configured within DirectAdmin):</p>
<p><code>ns1.domain.com -&gt; 12.34.56.78<br />
ns2.domain.com -&gt; 12.34.56.79</code></p>
<p>These name server entries need some time to populate to the internet (up to 24-48 hours).</p>
<p>In the meantime we need to add some more setting to the web server. Login to DirectAdmin and click &#8220;Administrator Settings&#8221;. Enter a server name within the field &#8220;Server&#8217;s Hostname&#8221;, I used serv01.domain.com. Enter the name server entries you have used before for the fields NS1 and NS2 and leave the DA control panel.</p>
<p><img src="http://www.web-development-blog.com/wp-content/uploads/2007/09/dascreen1.jpg" alt="DA admin settings" /></p>
<p>Now connect to your server via SSH (use Putty). Login as root (sudo) and enter:<br />
<code><br />
nano  /etc/hosts</code></p>
<p>With this command you enter the file &#8220;hosts&#8221; with the text editor <strong>Nano</strong> some distro&#8217;s may not include <strong>Nano</strong> in which case you may wish to use <strong>Pico</strong> or the adventurous <strong>Vi</strong>, add this row (check the Linux MAN pages how to insert text with teh editor <strong>Vi</strong>):</p>
<p><code>12.34.56.78 srv01.domain.com srv01</code></p>
<p>And save the file via <strong>ctrl+x</strong> (confirm to save the file) or :<strong>wq</strong> if you edit the file with <strong>Vi</strong>.</p>
<p>That&#8217;s all, you&#8217;re done!</p>
<p>I know there are much more distributions and also other cool control panel systems and I hope this guide will help you even if your system is different.</p>
<p><strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://www.web-development-blog.com/archives/start-a-hosting-business-with-directadmin/" rel="bookmark" title="July 21, 2010">Start a hosting business with DirectAdmin</a></li>
<li><a href="http://www.web-development-blog.com/archives/tel-domain-launch-the-next-mobile-story/" rel="bookmark" title="March 28, 2009">.tel domain launch, the next mobile story</a></li>
<li><a href="http://www.web-development-blog.com/archives/create-custom-website-backups-using-cron/" rel="bookmark" title="October 17, 2009">Create custom website backups using CRON</a></li>
</ul>
<p><!-- Similar Posts took 3.529 ms --></p>
<div style="clear:both;">&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.web-development-blog.com/archives/how-to-setup-the-dns-and-name-server-for-a-directadmin-web-server/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->