<?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>Thoughts Electrique &#187; 1und1</title>
	<atom:link href="http://www.sebastian.himberger.de/blog/tag/1und1/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sebastian.himberger.de/blog</link>
	<description>Sebastian Himbergers blog about technology and software development</description>
	<lastBuildDate>Thu, 08 Jul 2010 17:05:46 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Installing PHP / PECL ImageMagick extension on 1&amp;1 managed server</title>
		<link>http://www.sebastian.himberger.de/blog/2009/09/26/installing-php-pecl-imagemagick-extension-on-11-managed-server/</link>
		<comments>http://www.sebastian.himberger.de/blog/2009/09/26/installing-php-pecl-imagemagick-extension-on-11-managed-server/#comments</comments>
		<pubDate>Sat, 26 Sep 2009 03:42:16 +0000</pubDate>
		<dc:creator>Sebastian</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[1und1]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[ImageMagick]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PECL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.sebastian.himberger.de/blog/?p=477</guid>
		<description><![CDATA[I once had to install a custom PHP extension on a 1&#38;1 managed server. In this case the company had already purchased a managed server which was running the corporate website. They wanted to install an extranet-like webapplication which needed the ImageMagick PHP extension. In the following post I will outlike how I compiled and [...]]]></description>
			<content:encoded><![CDATA[<p>I once had to install a custom PHP extension on a <a title="1&amp;1 website" href="http://www.oneandone.com" target="_blank">1&amp;1</a> managed server. In this case the company had already purchased a managed server which was running the corporate website. They wanted to install an extranet-like webapplication which needed the <a title="ImageMagick extension" href="http://us3.php.net/manual/en/book.imagick.php">ImageMagick PHP extension</a>. In the following post I will outlike how I compiled and installed this extension on the managed server without having administrative access.</p>
<p><span id="more-477"></span></p>
<h3>Preparation</h3>
<p>To make the approach more modular we will use an environment variable pointing to our htdocs directory. I will call this variable $HTDOCS.</p>
<pre class="terminal">export HTDOCS=/kunden/homepages/.../htdocs</pre>
<p>We can check if everything is correct by changing into the htdocs directory.</p>
<pre class="terminal">cd $HTDOCS</pre>
<p>We will now create two directories:</p>
<ul>
<li><em>$HTDOCS/linux-src</em>: To hold all the data we need to compile the extensionn</li>
<li><em>$HTDOCS/linux</em>: To hold all the compiled data</li>
</ul>
<p>This setup allows us to delete the linux-src directory after we finished compiling the extension and save some diskspace.</p>
<pre class="terminal">mkdir -p $HTDOCS/linux-src
mkdir -p $HTDOCS/linux</pre>
<p>Now we will download the required sourcecode into our working directory:</p>
<pre class="terminal">mkdir -p $HTDOCS/linux-src/download
cd $HTDOCS/linux-src/download
wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz
wget http://pecl.php.net/get/imagick-2.3.0.tgz
wget ftp://ftp.remotesensing.org/pub/libtiff/tiff-3.8.2.tar.gz
wget http://us3.php.net/get/php-5.2.10.tar.gz/from/us.php.net/mirror</pre>
<p><strong>Note:</strong> The URLs to the latest versions may change over time. You will have to adjust them and also watch for changed file names in the following steps. Also be sure to use the PHP version currently active on your managed server.</p>
<h3>Extracting the sourcecode</h3>
<p>Now create a folder for the extracted sourcecode and extract the source archives:</p>
<pre class="terminal">mkdir -p $HTDOCS/linux-src/extracted/imagick
mkdir -p $HTDOCS/linux-src/extracted/php-imagick
mkdir -p $HTDOCS/linux-src/extracted/libtiff
mkdir -p $HTDOCS/linux-src/extracted/php5

cd $HTDOCS/linux-src/extracted/imagick &amp;&amp; tar xfz $HTDOCS/linux-src/download/ImageMagick.tar.gz
cd $HTDOCS/linux-src/extracted/php-imagick &amp;&amp; tar xfz $HTDOCS/linux-src/download/imagick-2.3.0.tgz
cd $HTDOCS/linux-src/extracted/libtiff &amp;&amp; tar xfz $HTDOCS/linux-src/download/tiff-3.8.2.tar.gz
cd $HTDOCS/linux-src/extracted/php5 &amp;&amp; tar xfz $HTDOCS/linux-src/download/php-5.2.10.tar.gz</pre>
<h3>Building delegate libraries</h3>
<p>ImageMagick uses different delegate libraries for certain formats. We have to build these first so they can be incorporated into our ImageMagick build. In this case we will only use libtiff to allow the usage of the TIFF image format.</p>
<h4>Building libtiff from source</h4>
<p>Building libtiff is pretty straightforward. Simply use the following commands inside the extracted source archive:</p>
<pre class="terminal">./configure --prefix=$HTDOCS/linux/
make
make install</pre>
<h3>Building ImageMagick from source</h3>
<p>Change into the extracted source directory and type in the following:</p>
<pre class="terminal">./configure --without-perl --prefix=$HTDOCS/linux \
  CPPFLAGS="-I$HTDOCS/linux/include" LDFLAGS="-L$HTDOCS/linux/lib/"
make
make install</pre>
<p>You can type the following command to test the compiled ImageMagick.</p>
<pre class="terminal">make check</pre>
<p>After ImageMagick is built we can now go on and create the PHP extension.</p>
<h3>Building the ImageMagick PHP extenstion</h3>
<p>To compile the extension we have to have a PHP development environment in place. To create one we&#8217;ll simply compile and install PHP (this sounds more scary than it is).</p>
<h4>Building PHP from source</h4>
<p>Change into the extracted PHP archive and type in the following:</p>
<pre class="terminal">./configure --prefix=$HTDOCS/linux
make
make test
make install</pre>
<p>The <em>make test</em> target will run the PHP test suite. You can expect some tests to fail but if the number of failing tests is overwhelming you should get suspicious.</p>
<h4>Building the ImageMagick PECL extension</h4>
<p>Change into the extracted source archive and type in the following:</p>
<pre class="terminal">phpize --clean
phpize
./configure --prefix=$HTDOCS/linux --with-php-config=/usr/bin/php-config5 --with-imagick=$HTDOCS/linux</pre>
<p>The configure script should go through. Unfortunately it seems that the prefix and paths will not be set correctly in the <em>Makefile</em>. We will have to adjust this and replace the /usr/local paths with the path to our $HTDOCS/linux</p>
<pre class="terminal">echo "$HTDOCS/linux" | sed -e 's/\//\\\//g' &gt; htdocs_pattern &amp;&amp; \
  export HTDOCS_PATTERN=`cat htdocs_pattern` &amp;&amp; rm htdocs_pattern
perl -pi -e "s/\/usr\/local/$HTDOCS_PATTERN/g" Makefile</pre>
<p><strong>Note</strong>: The above command looks a bit freaky and is a bit of a quick hack. What it basically does it is escaping the slashes (/) in the <em>$HTDOCS</em> path and writing this to a file. Then exporting the content of the file to an environment variable and deleting the file. After this PERL is used to replace all <em>/usr/local</em> paths in the <em>Makefile</em> to <em>$HTDOCS/linux</em></p>
<p>After that we are good to go and can build the extension:</p>
<pre class="terminal">./configure --prefix=$HTDOCS/linux
make
make install</pre>
<p>Now the extension should be build successfully and is placed in the directory <em>$HTDOCS/linux/somepath</em> (the <em>make install</em> will tell you the extact path) . The last thing we have to do is activating the extension.</p>
<h3>Activating the extension</h3>
<p>To activate the extension for a certain folder, create a file named php.ini (for example in the $HTDOCS directory) with the following content inside the folder:</p>
<pre class="file">extension_dir=$HTDOCS/linux/somepath
extension=imagick.so</pre>
<p>Also don&#8217;t forget to activate PHP 5 with using a <em>.htaccess</em> file:</p>
<pre class="file">AddType x-mapp-php5 .php
AddHandler x-mapp-php5 .php</pre>
<p>That&#8217;s all. If you have any questions feel free to comment. I hope this helps some of you.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sebastian.himberger.de/blog/2009/09/26/installing-php-pecl-imagemagick-extension-on-11-managed-server/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Static IPs and default route on 1und1 CentOS 5 Servers</title>
		<link>http://www.sebastian.himberger.de/blog/2009/03/11/static-ips-and-default-route-on-1und1-centos-5-servers/</link>
		<comments>http://www.sebastian.himberger.de/blog/2009/03/11/static-ips-and-default-route-on-1und1-centos-5-servers/#comments</comments>
		<pubDate>Wed, 11 Mar 2009 22:10:19 +0000</pubDate>
		<dc:creator>Sebastian</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[1und1]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.sebastian.himberger.de/blog/?p=358</guid>
		<description><![CDATA[I&#8217;ve been experiencing some serverdowns at a client who uses 1und1 CentOS 5 Servers. After some investigation I discovered that cronjobs were still running although the server appeared to be down. Checking the syslogs showed me a bunch of failed DHCP requests which remebered me of the fact that 1und1 uses DHCP to configure the [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been experiencing some serverdowns at a client who uses <a title="1und1 german website" href="http://www.1und1.de" target="_blank">1und1</a> <a title="Official CentOS website" href="http://www.centos.org/" target="_blank">CentOS </a>5 Servers. After some investigation I discovered that cronjobs were still running although the server appeared to be down. Checking the syslogs showed me a bunch of failed DHCP requests which remebered me of the fact that <strong>1und1 uses DHCP to configure the server machines</strong>. I don&#8217;t think this is a good idea so I changed the setup to static IPs.</p>
<p>Since 1und1 puts every server behind a dedicated firewall the setup is not as easy as you think. I&#8217;ll document it here because It may be useful for other people and certainly for myself after a couple of months.</p>
<h3>Configure a static IP address</h3>
<p>Open the file <em>/etc/sysconfig/network-scripts/ifcfg-eth0</em> and edit it to look like the following:</p>
<pre class="file">DEVICE=eth0
BOOTPROTO=none
TYPE=Ethernet
ONBOOT=yes
HWADDR=$YOURMACADDRESS
NETMASK=255.255.255.255
IPADDR=$YOURIP
GATEWAY=10.255.255.1</pre>
<p>Save the file.</p>
<h3>Configure static routes</h3>
<p>This is the tricky part. Configuring a default gateway using the <em>GATEWAY=</em> setting is not enough. You have to setup the routes yourself. To do so create a new file <em>/etc/sysconfig/network-scripts/route-eth0 </em>with the following contents:</p>
<pre class="file">10.255.255.1 dev eth0
default via 10.255.255.1 dev eth0</pre>
<p>Now you only have to reload the networking configuration via</p>
<pre class="terminal">service network reload</pre>
<p>and you are done!</p>
<p><a title="Tutorial for CentOS4" href="http://webui.sourcelabs.com/centos/mail/user/threads/How_to_create_static_routes_on_startup_with_CentOS4%253F.meta" target="_blank">This post</a> helped me a lot with the solution.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sebastian.himberger.de/blog/2009/03/11/static-ips-and-default-route-on-1und1-centos-5-servers/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
