<?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>sebthom.de &#187; PHP</title>
	<atom:link href="http://sebthom.de/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://sebthom.de</link>
	<description>IT Freelancer - Java, J2EE, IBM WebSphere Portal, Lotus Notes/Domino</description>
	<lastBuildDate>Sun, 14 Mar 2010 14:10:25 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Installing Tomcat 6 on Debian Squeeze</title>
		<link>http://sebthom.de/142-installing-tomcat-6-debian-squeeze/</link>
		<comments>http://sebthom.de/142-installing-tomcat-6-debian-squeeze/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 16:07:35 +0000</pubDate>
		<dc:creator>Sebastian Thomschke</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[port 80]]></category>
		<category><![CDATA[port forwarding]]></category>
		<category><![CDATA[quercus]]></category>
		<category><![CDATA[tomcat]]></category>
		<category><![CDATA[vhost]]></category>
		<category><![CDATA[virtual servers]]></category>
		<category><![CDATA[VPS]]></category>
		<category><![CDATA[xinetd]]></category>

		<guid isPermaLink="false">http://sebthom.de/?p=142</guid>
		<description><![CDATA[     <link rel="alternate" type="application/atom+xml" title="sebthom.de Category: Java" href="http://sebthom.de/category/it/development/java-coding/feed/" />
     <link rel="alternate" type="application/atom+xml" title="sebthom.de Category: Linux" href="http://sebthom.de/category/it/linux/feed/" />
This post describes how to setup Tomcat 6 on Debian Squeeze. The configured Tomcat serves requests on port 80 without the need of an additional web server. This is especially good for virtual servers (VPS) providing limit memory. It also has multiple virtual hosts configured, each with it&#8217;s own webapp with context root / and [...]]]></description>
			<content:encoded><![CDATA[<p>This post describes how to setup Tomcat 6 on Debian Squeeze. The configured Tomcat serves requests on port 80 without the need of an additional web server. This is especially good for virtual servers (VPS) providing limit memory. It also has multiple virtual hosts configured, each with it&#8217;s own webapp with context root / and optional support for PHP via the Quercus PHP implementation.</p>
<h3>Installing Sun Java 6</h3>
<p>Ensure the non-free section is enabled for the APT repository configuration in /etc/apt/sources.list, e.g. &#8220;deb http://ftp.de.debian.org/debian testing main contrib non-free&#8221;</p>
<pre name="code" class="php">
apt-get update
apt-get install sun-java6-jdk
echo 'JAVA_HOME="/usr/lib/jvm/java-6-sun"' >> /etc/environment
echo 'JRE_HOME="/usr/lib/jvm/java-6-sun/jre"' >> /etc/environment
</pre>
<h3>Installing Tomcat 6</h3>
<pre  name="code" class="php">
apt-get install tomcat6 tomcat6-admin
/etc/init.d/tomcat6 stop
</pre>
<h3>Creating standard Tomcat directory layout</h3>
<pre name="code" class="php">
mkdir /opt/tomcat
cd /opt/tomcat
ln -s /etc/tomcat6/ conf
ln -s /usr/share/tomcat6/bin/ bin
ln -s /usr/share/tomcat6/lib/ lib
ln -s /var/lib/tomcat6/webapps webapps
ln -s /var/log/tomcat6/ logs
</pre>
<h3>Creating a Tomcat admin user</h3>
<p>In /opt/tomcat/conf/tomcat-users.xml add an entry like:</p>
<pre name="code" class="xml">
&lt;user name="ADMIN_USERNAME" password="ADMIN_PASSWORD" roles="admin,manager" /&gt;
</pre>
<h3>Setting up virtual hosts</h3>
<p>For each virtual host execute the following command. Replace &#8220;mydomain.com&#8221; with the desired virtual host name, but omit the &#8220;www.&#8221; part.</p>
<pre name="code" class="php">
mkdir -p /opt/tomcat/webapps.mydomain.com/ROOT
</pre>
<p>In the &lt;Engine&gt; tag of &#8220;/opt/tomcat/conf/server.xml&#8221; add one host entry for each virtual host.</p>
<pre name="code" class="xml">
&lt;Host name="mydomain.com" appBase="/opt/tomcat/webapps.mydomain.com"&gt;
    &lt;Alias&gt;www.mydomain.com&gt;/Alias&gt;
    &lt;Valve className="org.apache.catalina.valves.AccessLogValve" prefix="mydomain_access_log." suffix=".txt" pattern="common"/&gt;
&lt;/Host&gt;
</pre>
<p>The &lt;Alias&gt; tag tells Tomcat to redirect from www.mydomain.com to mydomain.com.<br />
The &lt;Valve&gt; tag enables access logging in the standard logging format.</p>
<h3>Using xinetd to configure port 80 for Tomcat</h3>
<p>Binding a service on port 80 requires root permissions. Thus we use port forwarding to &#8220;bind&#8221; Tomcat to port 80. My VPS does not support the use of &#8220;iptables -j REDIRECT&#8221; therefore I am using xinetd as a web proxy.<br />
Ensure that no other service is listening on port 80/443:</p>
<pre name="code" class="php">
netstat -pan | grep ":80\|:443"
</pre>
<p>Register the required xinetd services:</p>
<pre name="code" class="php">
echo echo "
service www
{
        socket_type     = stream
        protocol        = tcp
        user            = root
        wait            = no
        bind            = 88.80.198.181
        port            = 80
        redirect        = localhost 8080
        disable         = no
        flags           = REUSE
        log_type        = FILE /var/log/wwwaccess.log
        log_on_success  -= PID HOST DURATION EXIT

        per_source      = UNLIMITED
        instances       = UNLIMITED
}

service https
{
        socket_type     = stream
        protocol        = tcp
        user            = root
        wait            = no
        bind            = 88.80.198.181
        port            = 443
        redirect        = localhost 8443
        disable         = no
        flags           = REUSE
        log_type        = FILE /var/log/httpsaccess.log
        log_on_success  -= PID HOST DURATION EXIT

        per_source      = UNLIMITED
        instances       = UNLIMITED
}
" > /etc/init.d/tomcat
/etc/init.d/xinetd restart
</pre>
<p>If you want to use a different service name, e.g. &#8220;tomcat&#8221; instead of &#8220;www&#8221; you must add this service to /var/services, e.g. &#8220;tomcat 80/tcp&#8221;<br />
In /opt/tomcat/conf/server.xml modify the &lt;Connector&gt; as follows:</p>
<pre name="code" class="xml">
&lt;Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" proxyPort="80" address="127.0.0.1" /&gt;
</pre>
<p>This binds Tomcat to localhost. It also tells Tomcat that port 80 is the proxy port which is necessary for correct URL generation.<br />
From now on the Tomcat admin applications are only accessible via localhost. You can use SSH port forwarding to still access the applications from your workstation&#8217;s web browser. E.g. if you are using <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html">PuTTY</a> you can use this command line option &#8220;-L 8080:localhost:8080&#8243; to forward the server&#8217;s local 8080 port to your workstation&#8217;s local 8080 port. On your workstation&#8217;s browser you then simply enter <a href="http://localhost:8080/manager/html">http://localhost:8080/manager/html</a> and are connected to the server&#8217;s Tomcat admin application.</p>
<h3>Enabling PHP support (optional)</h3>
<p>Download <a href="http://quercus.caucho.com/">Quercus</a>.</p>
<pre name="code" class="php">
mkdir -p /opt/downloads
wget -o /opt/downloads/quercus-4.0.3.war http://caucho.com/download/quercus-4.0.3.war
</pre>
<p>Install Quercus as a shared library.</p>
<pre name="code" class="php">
unzip -j /opt/downloads/quercus-4.0.3.war \*.jar -d /opt/tomcat/lib
</pre>
<p>Enable PHP support for the virtual hosts by installing the quercus web.xml. For each virtual host execute:</p>
<pre name="code" class="php">
unzip /opt/downloads/quercus-4.0.3.war *web.xml -d /opt/tomcat/webapps.mydomain.com/ROOT
</pre>
<h3>Starting Tomcat</h3>
<pre name="code" class="php">
/etc/init.d/tomcat start
</pre>
<h3>References</h3>
<ul>
<li><a href="http://www.ibm.com/developerworks/java/library/l-secjav.html#h5">Securing Linux for Java services: The port dilemma</a>
<li><a href="http://ruleoftech.com/journal/redirecting-http-and-https-traffic-to-tomcats-ports">Redirect HTTP and HTTPS traffic to Tomcat&#8217;s ports</a>
<li><a href="http://tomcat.apache.org/tomcat-6.0-doc/virtual-hosting-howto.html">Tomcat 6: Virtual Hosting How To</a>
<li><a href="http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html">Tomcat 6: Classloader How To</a>
<li><a href="http://www.ex-parrot.com/pete/tomcat-vhost.html">Virtual Hosting with Tomcat</a>
<li><a href="http://wiki.caucho.com/Quercus:_Tomcat">Quercus: Tomcat</a>
<li><a href="http://www.ubuntugeek.com/how-to-install-tomcat-6-on-ubuntu-9-04-jaunty.html">How to install Tomcat 6 on Ubuntu 9.04 (Jaunty)</a>
</ul>
 <img src="http://sebthom.de/wp-content/plugins/feed-statistics.php?view=1&post_id=142" width="1" height="1" style="display: none;" /><hr />
<p><small>&copy; sebthom for <a href="http://sebthom.de">sebthom.de</a>, 2010. |
<a href="http://sebthom.de/142-installing-tomcat-6-debian-squeeze/">Permalink</a> |
<a href="http://sebthom.de/142-installing-tomcat-6-debian-squeeze/#comments">No comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://sebthom.de/142-installing-tomcat-6-debian-squeeze/&amp;title=Installing Tomcat 6 on Debian Squeeze">del.icio.us</a>
<br/>
Post tags: <a href="http://sebthom.de/tag/java/" rel="nofollow tag">Java</a>, <a href="http://sebthom.de/tag/php/" rel="nofollow tag">PHP</a>, <a href="http://sebthom.de/tag/port-80/" rel="nofollow tag">port 80</a>, <a href="http://sebthom.de/tag/port-forwarding/" rel="nofollow tag">port forwarding</a>, <a href="http://sebthom.de/tag/quercus/" rel="nofollow tag">quercus</a>, <a href="http://sebthom.de/tag/tomcat/" rel="nofollow tag">tomcat</a>, <a href="http://sebthom.de/tag/vhost/" rel="nofollow tag">vhost</a>, <a href="http://sebthom.de/tag/virtual-servers/" rel="nofollow tag">virtual servers</a>, <a href="http://sebthom.de/tag/vps/" rel="nofollow tag">VPS</a>, <a href="http://sebthom.de/tag/xinetd/" rel="nofollow tag">xinetd</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://sebthom.de/142-installing-tomcat-6-debian-squeeze/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Solved] Blank Pages with Wordpress 2.6.x</title>
		<link>http://sebthom.de/63-solved-blank-pages-with-wordpress-26x/</link>
		<comments>http://sebthom.de/63-solved-blank-pages-with-wordpress-26x/#comments</comments>
		<pubDate>Sat, 13 Sep 2008 18:57:59 +0000</pubDate>
		<dc:creator>Sebastian Thomschke</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[workaround]]></category>

		<guid isPermaLink="false">http://sebthom.de/?p=63&amp;langswitch_lang=de</guid>
		<description><![CDATA[After upgrading to Wordpress 2.6 it occasionally happend that an empty page was displayed in the browser when navigating through the blog or working in the admin area. Refreshing the browser using CTRL+F5 usually helped in that case. Today I upgraded to Wordpress 2.6.2 and I was not able to access the plug-ins page of [...]]]></description>
			<content:encoded><![CDATA[<p>After upgrading to Wordpress 2.6 it occasionally happend that an empty page was displayed in the browser when navigating through the blog or working in the admin area. Refreshing the browser using CTRL+F5 usually helped in that case. Today I upgraded to Wordpress 2.6.2 and I was not able to access the plug-ins page of the admin area anymore. No matter how often I refreshed the page in the browser it stayed blank.<br />
First I searched the web for possible solutions. I found quite a number of discussions giving tips about this widely known problem but unfortunately none of these solutions helped in my case.<br />
So I again started debugging the Wordpress code and finally found the lines of code causing the trouble. The problem are <b>(object)</b> casts in the <strong>wp-includes/taxonomy.php</strong> file that transform an array into an object:</p>
<pre class="php" name="code">$wp_taxonomies['category'] = (object) array('name' => 'category', 'object_type' => 'post', 'hierarchical' => true, 'update_count_callback' => '_update_post_term_count');
$wp_taxonomies['post_tag'] = (object) array('name' => 'post_tag', 'object_type' => 'post', 'hierarchical' => false, 'update_count_callback' => '_update_post_term_count');
$wp_taxonomies['link_category'] = (object) array('name' => 'link_category', 'object_type' => 'link', 'hierarchical' => false);
</pre>
<p>Since I don&#8217;t get any error messages neither on the screen nor in the log files I have no idea why these casts fail. The PHP version used to serve the site is the latest stable 5.x release from php.net.<br />
As a workaround I introduced a function that does also transforms an array into an object but does not rely on the casting mechanism.</p>
<pre class="php" name="code">function arr2obj($arr) {
	foreach ($arr as $k => $v) $obj -> {$k} = $v;
	return $obj;
}

$wp_taxonomies['category'] = arr2obj(array('name' => 'category', 'object_type' => 'post', 'hierarchical' => true, 'update_count_callback' => '_update_post_term_count'));
$wp_taxonomies['post_tag'] = arr2obj(array('name' => 'post_tag', 'object_type' => 'post', 'hierarchical' => false, 'update_count_callback' => '_update_post_term_count'));
$wp_taxonomies['link_category'] = arr2obj(array('name' => 'link_category', 'object_type' => 'link', 'hierarchical' => false));
</pre>
 <img src="http://sebthom.de/wp-content/plugins/feed-statistics.php?view=1&post_id=63" width="1" height="1" style="display: none;" /><hr />
<p><small>&copy; sebthom for <a href="http://sebthom.de">sebthom.de</a>, 2008. |
<a href="http://sebthom.de/63-solved-blank-pages-with-wordpress-26x/">Permalink</a> |
<a href="http://sebthom.de/63-solved-blank-pages-with-wordpress-26x/#comments">One comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://sebthom.de/63-solved-blank-pages-with-wordpress-26x/&amp;title=[Solved] Blank Pages with Wordpress 2.6.x">del.icio.us</a>
<br/>
Post tags: <a href="http://sebthom.de/tag/bug/" rel="nofollow tag">bug</a>, <a href="http://sebthom.de/tag/php/" rel="nofollow tag">PHP</a>, <a href="http://sebthom.de/tag/wordpress/" rel="nofollow tag">Wordpress</a>, <a href="http://sebthom.de/tag/workaround/" rel="nofollow tag">workaround</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://sebthom.de/63-solved-blank-pages-with-wordpress-26x/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Making the DD Sitemap Generator Plug-in work with multilingual blogs</title>
		<link>http://sebthom.de/55-making_dd_sitemap_generator_plugin_work_with_multilingual_blogs/</link>
		<comments>http://sebthom.de/55-making_dd_sitemap_generator_plugin_work_with_multilingual_blogs/#comments</comments>
		<pubDate>Thu, 01 May 2008 21:47:38 +0000</pubDate>
		<dc:creator>Sebastian Thomschke</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[workaround]]></category>

		<guid isPermaLink="false">http://sebthom.de/55-making_dd_sitemap_generator_plugin_work_with_multilingual_blogs/</guid>
		<description><![CDATA[To create a bilingual blog with WordPress I am using the Language Switcher Plug-in. This plug-in allows you to put content in more than one language into the post title and content fields by surrounding the localized texts with special tags indicating their language (e.g. &#8220;[ lang_en]Hello World[ /lang_en][ lang_de]Hallo Welt[ /lang_de]&#8220;). When the posts [...]]]></description>
			<content:encoded><![CDATA[<p>To create a bilingual blog with <a href="http://wordpress.org/" target="_blank">WordPress</a> I am using the <a href="http://www.poplarware.com/languageplugin.html" target="_blank">Language Switcher Plug-in</a>. This plug-in allows you to put content in more than one language into the post title and content fields by surrounding the localized texts with special tags indicating their language (e.g. <strong>&#8220;[ lang_en]Hello World[ /lang_en][ lang_de]Hallo Welt[ /lang_de]&#8220;</strong>). When the posts are viewed in the browser the plug-in will determine the active language and strip off the texts specified in all other languages on the fly.</p>
<p>I am using the great <a href="http://www.dagondesign.com/articles/sitemap-generator-plugin-for-wordpress/" target="_blank">DD Sitemap Generator Plug-in for WordPress</a>&nbsp; to automatically render a site map based on the posts, pages and categories created in my blog. The problem however is that the generated site map is not language aware and displays the page/post titles and category names including the tags and the texts of all languages at once. </p>
<p>To solve this I started digging a bit into the code of WordPress and the Language Switcher Plug-in. The Language Switcher Plug-in achieves the on-the-fly processing of multilingual texts by hooking itself into the so called <a href="http://codex.wordpress.org/Plugin_API/Filter_Reference" target="_blank">Filters API</a> which is something like an event-based callback mechanism. Plug-ins can signal their interest in a certain text filter event by calling the <a href="http://codex.wordpress.org/Function_Reference/add_filter" target="_blank">add_filter(the_event_id, the_name_of_a_function_to_callback)</a> function provided by the WordPress API to register one if it&#8217;s functions that will be invoked by WordPress when the filter event occurs. Besides registering for filter events, plug-ins can also fire such events by calling the <a href="http://codex.wordpress.org/Function_Reference/apply_filters" target="_blank">apply_filters(the_event_id, the_text_to_be_filtered)</a>. WordPress will then apply all registered filters to the text passed over and the apply_filters will return a &#8220;filtered&#8221; version of the passed text. When rendering the title of a post or page WordPress fires the filter event &#8220;the_title&#8221; allowing plug-ins to process/modify the title before it is actually displayed. Therefore the Language Switcher Plug-in registers itself to this event and a lot of others to be able to strip off the language tags and the texts in languages other than the currently active one.</p>
<p>Unfortunately the DD Sitemap Generator Plug-in is currently not applying the respective filters when rendering the site map. Therefore the Language Switcher Plug-in is not aware of it and as a result the site map shows all translations of a category name or page/post title at the same time no matter which language is currently active.</p>
<p>To solve this problem I analyzed the source code of the DD Sitemap Generator Plug-in and added the missing <strong>apply_filters</strong> calls where appropriate. You can follow these steps in case you are having the same issue:</p>
<ol>
<li>Open the file <strong>&lt;wordpress_root&gt;/wp-content/plugins/sitemap-generator/sitemap-generator.php</strong> (or <strong>&lt;wordpress_root&gt;/wp-content/plugins/dd-sitemap-gen/dd-sitemap-gen.php</strong>) in an editor
<li>Locate the text<br />&nbsp;&nbsp; <font face="Courier New">$tmp_array['title'] = $pages[$k]-&gt;post_title;</font><br />and replace it with<br />&nbsp;&nbsp; <font face="Courier New">$tmp_array['title'] = <strong>apply_filters(&#8216;the_title&#8217;, </strong>$pages[$k]-&gt;post_title<strong>)</strong>;</font>
<li>Locate the text<br />&nbsp;&nbsp; <font face="Courier New">$tmp_array['title'] = $cat_data[$c]['cat_name'];</font><br />and replace it with<br />&nbsp;&nbsp; <font face="Courier New">$tmp_array['title'] = <strong>apply_filters(&#8216;the_category&#8217;, </strong>$cat_data[$c]['cat_name']<strong>)</strong>;</font>
<li>Locate the text<br />&nbsp;&nbsp; <font face="Courier New">$tmp_array['title'] = $posts[$k]-&gt;post_title;</font><br />and replace it with<br />&nbsp;&nbsp; <font face="Courier New">$tmp_array['title'] = <strong>apply_filters(&#8216;the_title&#8217;, </strong>$posts[$k]-&gt;post_title<strong>)</strong>;</font>
<li>Save the file and you are done.</li>
</ol>
<p>If you are encountering similar problems with other plug-in you can use the same approach to make them play nicely with the Language Switcher Plug-in.</p></p>
 <img src="http://sebthom.de/wp-content/plugins/feed-statistics.php?view=1&post_id=55" width="1" height="1" style="display: none;" /><hr />
<p><small>&copy; sebthom for <a href="http://sebthom.de">sebthom.de</a>, 2008. |
<a href="http://sebthom.de/55-making_dd_sitemap_generator_plugin_work_with_multilingual_blogs/">Permalink</a> |
<a href="http://sebthom.de/55-making_dd_sitemap_generator_plugin_work_with_multilingual_blogs/#comments">3 comments</a> |
Add to
<a href="http://del.icio.us/post?url=http://sebthom.de/55-making_dd_sitemap_generator_plugin_work_with_multilingual_blogs/&amp;title=Making the DD Sitemap Generator Plug-in work with multilingual blogs">del.icio.us</a>
<br/>
Post tags: <a href="http://sebthom.de/tag/php/" rel="nofollow tag">PHP</a>, <a href="http://sebthom.de/tag/wordpress/" rel="nofollow tag">Wordpress</a>, <a href="http://sebthom.de/tag/workaround/" rel="nofollow tag">workaround</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://sebthom.de/55-making_dd_sitemap_generator_plugin_work_with_multilingual_blogs/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>[Solved] WordPress 2.5 One-Click Plug-in Upgrades &#8211; Could not create directory</title>
		<link>http://sebthom.de/54-solved-wordpress-25-one-click-plugin-update-problem-could-not-create-directory/</link>
		<comments>http://sebthom.de/54-solved-wordpress-25-one-click-plugin-update-problem-could-not-create-directory/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 23:44:06 +0000</pubDate>
		<dc:creator>Sebastian Thomschke</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[workaround]]></category>

		<guid isPermaLink="false">http://sebthom.de/54-solved-wordpress-25-one-click-plugin-update-problem-could-not-create-directory/</guid>
		<description><![CDATA[Some days ago I upgraded my WordPress installation to the new 2.5 release. Being a lazy guy I of course wanted to use the new on-click plug-in upgrades feature to update several plug-ins. Trying to one-click update some of the out-dated plug-ins only resulted in the rather meaningless error message &#8220;Could not create directory&#8221;. So [...]]]></description>
			<content:encoded><![CDATA[<p>Some days ago I upgraded my WordPress installation to the new <a href="http://wordpress.org/development/2008/03/wordpress-25-brecker/" target="_blank">2.5 release</a>. Being a lazy guy I of course wanted to use the new <a href="http://wordpress.org/development/2008/03/wordpress-25-brecker/" target="_blank">on-click plug-in upgrades</a> feature to update several plug-ins. Trying to one-click update some of the out-dated plug-ins only resulted in the rather meaningless error message &#8220;Could not create directory&#8221;. So I started searching the web for possible solutions. I quickly found <a href="http://wordpress.org/support/topic/164174" target="_blank">some</a> <a href="http://blog.fabrice-pascal.de/item/1132/2008/04/06/" target="_blank">posts</a> explaining this issue to be a directory permission problem. Manually creating the /wp-content/upgrade directory and chmoding it as well as the plug-in directories to 777 should solve the problem. Unfortunately not for me. Therefore I rolled up my sleeves and started to debug WordPress&#8230;</p>
<p>To cut a long story short, eventually I came across this PHP bug report <a href="http://bugs.php.net/bug.php?id=42739" target="_blank">#42739 mkdir doesn&#8217;t like a trailing slash when safe_mode is enabled</a> and it turned out that this was the issue I was facing with on my hosting account too. The safe_mode option is enabled and WordPress tries to create directories that end with a slash (e.g. /htdocs/wp-content/upgrade/the-plugin<strong>/</strong>).</p>
<p>After knowing the reason I could develop a workaround and finally got the one-click updater running. If you are facing the same issue you can try to use my patch too.</p>
<ol>
<li>Locate and open the file <strong>&lt;wp_root&gt;/wp_admin/includes/class-wp-filesystem-direct.php</strong> in an editor <br /> 
<li>Search for &#8220;<strong>function mkdir</strong>&#8221; <br /> 
<li>Add the following statements to this method
<pre class="php" name="code">function mkdir($path,$chmod=false,$chown=false,$chgrp=false){
	if( ! $chmod)
		$chmod = $this-&gt;permission;

	// workaround for http://bugs.php.net/bug.php?id=42739 starts here
	if(ini_get('safe_mode') &amp;&amp; substr($path, -1) == '/')
	{
		$path = substr($path, 0, -1);
	}
	// workaround for http://bugs.php.net/bug.php?id=42739 ends here

	if( !@mkdir($path,$chmod) )
		return false;
	if( $chown )
		$this-&gt;chown($path,$chown);
	if( $chgrp )
		$this-&gt;chgrp($path,$chgrp);
	return true;
}</pre>
<li>Start one-click updating! </li>
</ol>
<p><b>Addendum:</b>
<ol>
<li>The patch also works for WordPress 2.5.1</li>
<li>If applying this patch does not lead to success the problem may have a second cause. Therefore also check the permissions on the /wp-content/upgrade/ folder and it&#8217;s sub folders, e.g. chmod them to 777. If the upgrade directory does not exist at all it may be sufficient to create it manually.</li>
</ol>
<p>
 <img src="http://sebthom.de/wp-content/plugins/feed-statistics.php?view=1&post_id=54" width="1" height="1" style="display: none;" /><hr />
<p><small>&copy; sebthom for <a href="http://sebthom.de">sebthom.de</a>, 2008. |
<a href="http://sebthom.de/54-solved-wordpress-25-one-click-plugin-update-problem-could-not-create-directory/">Permalink</a> |
<a href="http://sebthom.de/54-solved-wordpress-25-one-click-plugin-update-problem-could-not-create-directory/#comments">30 comments</a> |
Add to
<a href="http://del.icio.us/post?url=http://sebthom.de/54-solved-wordpress-25-one-click-plugin-update-problem-could-not-create-directory/&amp;title=[Solved] WordPress 2.5 One-Click Plug-in Upgrades &#8211; Could not create directory">del.icio.us</a>
<br/>
Post tags: <a href="http://sebthom.de/tag/bug/" rel="nofollow tag">bug</a>, <a href="http://sebthom.de/tag/php/" rel="nofollow tag">PHP</a>, <a href="http://sebthom.de/tag/wordpress/" rel="nofollow tag">Wordpress</a>, <a href="http://sebthom.de/tag/workaround/" rel="nofollow tag">workaround</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://sebthom.de/54-solved-wordpress-25-one-click-plugin-update-problem-could-not-create-directory/feed/</wfw:commentRss>
		<slash:comments>30</slash:comments>
		</item>
		<item>
		<title>myPodder &#8211; a mobile podcatcher</title>
		<link>http://sebthom.de/49-mypodder-mobile-podcatcher/</link>
		<comments>http://sebthom.de/49-mypodder-mobile-podcatcher/#comments</comments>
		<pubDate>Sun, 20 Apr 2008 19:59:25 +0000</pubDate>
		<dc:creator>Sebastian Thomschke</dc:creator>
				<category><![CDATA[Freeware Tips]]></category>
		<category><![CDATA[audio]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[podcasts]]></category>

		<guid isPermaLink="false">http://sebthom.de/?p=49&amp;langswitch_lang=de</guid>
		<description><![CDATA[Two weeks ago I started trying out podcasts seriously for the first time. So far I mainly tried the ones from a German news radio station (http://www.dradio.de/podcast/). I downloaded the audio files about topics I found interesting and listened to them while travelling to and from work. I really enjoyed it &#8211; especially because of [...]]]></description>
			<content:encoded><![CDATA[<p>Two weeks ago I started trying out podcasts seriously for the first time. So far I mainly tried the ones from a German news radio station (<a target="_blank" href="http://www.dradio.de/podcast/">http://www.dradio.de/podcast/</a>). I downloaded the audio files about topics I found interesting and listened to them while travelling to and from work. I really enjoyed it &#8211; especially because of the facts that I could now listen to talks and reports I am really interested in and I didn&#8217;t had to pay attention to when they are broadcasted. However I found it quite cumbersome to navigate through the radio station&#8217;s web page, to select each podcast separately, to download them and finally to transfer them to my neat <a target="_blank" href="http://www.amazon.com/dp/B000S6Q2A8/?tag=sten-post-20">Samsung T9</a>.
<p>So I started looking for some tools that could simplify this process. I finally came across a handy software called <a href="http://www.podcastready.com/download.php">myPodder</a> provided for free by <a href="http://www.podcastready.com/">Podcast Ready</a>. Podcast Ready provides an online catalog of available podcasts from different sources and to my surprise they also have that German radio station listed. The interesting thing about their software is the fact that you can directly install it onto your mobile audio player and have it launched automatically the moment it is connected to a computer. This means you can easily charge your player with new podcasts from any computer having an internet connection. Simply connect the player, wait for the program to launch, select some new podcasts and download them.<br />(...)<br/>Read the rest of <a href="http://sebthom.de/49-mypodder-mobile-podcatcher/">myPodder &#8211; a mobile podcatcher</a> (0 words)</p>
<hr />
<p><small>&copy; sebthom for <a href="http://sebthom.de">sebthom.de</a>, 2008. |
<a href="http://sebthom.de/49-mypodder-mobile-podcatcher/">Permalink</a> |
<a href="http://sebthom.de/49-mypodder-mobile-podcatcher/#comments">No comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://sebthom.de/49-mypodder-mobile-podcatcher/&amp;title=myPodder &#8211; a mobile podcatcher">del.icio.us</a>
<br/>
Post tags: <a href="http://sebthom.de/tag/audio/" rel="nofollow tag">audio</a>, <a href="http://sebthom.de/tag/php/" rel="nofollow tag">PHP</a>, <a href="http://sebthom.de/tag/podcasts/" rel="nofollow tag">podcasts</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://sebthom.de/49-mypodder-mobile-podcatcher/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My favorite WordPress Plug-ins &amp; Resources</title>
		<link>http://sebthom.de/46-favorite-wordpress-resources/</link>
		<comments>http://sebthom.de/46-favorite-wordpress-resources/#comments</comments>
		<pubDate>Sun, 30 Sep 2007 09:04:13 +0000</pubDate>
		<dc:creator>Sebastian Thomschke</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[audio]]></category>
		<category><![CDATA[MP3]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://sebthom.de/46-lang_enmy-favorite-wordpress-resourceslang_enlang_demeine-favorisierten-wordpress-ressourcenlang_de/lang/de</guid>
		<description><![CDATA[Now that I gained some experiences with WordPress, here comes a list of my favorite WordPress Plug-ins:
(...)Read the rest of My favorite WordPress Plug-ins &#38; Resources (717 words)

&#169; sebthom for sebthom.de, 2007. &#124;
Permalink &#124;
3 comments &#124;
Add to
del.icio.us

Post tags: audio, MP3, PHP, Wordpress

Feed enhanced by Better Feed from  Ozh
]]></description>
			<content:encoded><![CDATA[<p>Now that I gained some experiences with WordPress, here comes a list of my favorite WordPress Plug-ins:</p>
<p>(...)<br/>Read the rest of <a href="http://sebthom.de/46-favorite-wordpress-resources/">My favorite WordPress Plug-ins &amp; Resources</a> (717 words)</p>
<hr />
<p><small>&copy; sebthom for <a href="http://sebthom.de">sebthom.de</a>, 2007. |
<a href="http://sebthom.de/46-favorite-wordpress-resources/">Permalink</a> |
<a href="http://sebthom.de/46-favorite-wordpress-resources/#comments">3 comments</a> |
Add to
<a href="http://del.icio.us/post?url=http://sebthom.de/46-favorite-wordpress-resources/&amp;title=My favorite WordPress Plug-ins &amp; Resources">del.icio.us</a>
<br/>
Post tags: <a href="http://sebthom.de/tag/audio/" rel="nofollow tag">audio</a>, <a href="http://sebthom.de/tag/mp3/" rel="nofollow tag">MP3</a>, <a href="http://sebthom.de/tag/php/" rel="nofollow tag">PHP</a>, <a href="http://sebthom.de/tag/wordpress/" rel="nofollow tag">Wordpress</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://sebthom.de/46-favorite-wordpress-resources/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Hello World again!</title>
		<link>http://sebthom.de/44-hello-world-again/</link>
		<comments>http://sebthom.de/44-hello-world-again/#comments</comments>
		<pubDate>Fri, 28 Sep 2007 09:34:33 +0000</pubDate>
		<dc:creator>Sebastian Thomschke</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://sebthom.de/44-lang_enhello-world-againlang_enlang_dehallo-welt-klappe-die-zweitelang_de/</guid>
		<description><![CDATA[Finally, after years of static HTML pages, self-built PHP scripts, and the evaluation of dozens of open source content management systems and blogging tools I finally decided to give WordPress a try. Now the hard migration work is done and my site is up and running with a fresh new design providing all the neat [...]]]></description>
			<content:encoded><![CDATA[<p>Finally, after years of static HTML pages, self-built PHP scripts, and the evaluation of dozens of open source content management systems and blogging tools I finally decided to give WordPress a try. Now the hard migration work is done and my site is up and running with a fresh new design providing all the neat features expected from a bleading-edge Web 2.0-ish site.</p>
 <img src="http://sebthom.de/wp-content/plugins/feed-statistics.php?view=1&post_id=44" width="1" height="1" style="display: none;" /><hr />
<p><small>&copy; sebthom for <a href="http://sebthom.de">sebthom.de</a>, 2007. |
<a href="http://sebthom.de/44-hello-world-again/">Permalink</a> |
<a href="http://sebthom.de/44-hello-world-again/#comments">No comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://sebthom.de/44-hello-world-again/&amp;title=Hello World again!">del.icio.us</a>
<br/>
Post tags: <a href="http://sebthom.de/tag/php/" rel="nofollow tag">PHP</a>, <a href="http://sebthom.de/tag/wordpress/" rel="nofollow tag">Wordpress</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://sebthom.de/44-hello-world-again/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MyPad v1.1.6 &#8211; a PHP Editor</title>
		<link>http://sebthom.de/23-mypad-php-editor/</link>
		<comments>http://sebthom.de/23-mypad-php-editor/#comments</comments>
		<pubDate>Mon, 26 Jul 2004 19:26:49 +0000</pubDate>
		<dc:creator>Sebastian Thomschke</dc:creator>
				<category><![CDATA[My Freeware]]></category>
		<category><![CDATA[Visual Basic]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://sebthom.de/2007/09/mypad-v116-langenalangenlangdeeinlangde-php-editor-03072004/</guid>
		<description><![CDATA[MyPad is a very compact PHP Editor. I developed this editor because I could not find a suitable PHP Editor with a Single Document Interface.
The Editor I was searching for should look and behave like Notepad, but should be able to colorize PHP source code.
Such a small Editor can be perfectly used in conjunction with [...]]]></description>
			<content:encoded><![CDATA[<p>MyPad is a very compact PHP Editor. I developed this editor because I could not find a suitable PHP Editor with a Single Document Interface.<br />
The Editor I was searching for should look and behave like Notepad, but should be able to colorize PHP source code.<br />
Such a small Editor can be perfectly used in conjunction with a norton commander like filemanager.</p>
<p>(...)<br/>Read the rest of <a href="http://sebthom.de/23-mypad-php-editor/">MyPad v1.1.6 &#8211; a PHP Editor</a> (123 words)</p>
<hr />
<p><small>&copy; sebthom for <a href="http://sebthom.de">sebthom.de</a>, 2004. |
<a href="http://sebthom.de/23-mypad-php-editor/">Permalink</a> |
<a href="http://sebthom.de/23-mypad-php-editor/#comments">No comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://sebthom.de/23-mypad-php-editor/&amp;title=MyPad v1.1.6 &#8211; a PHP Editor">del.icio.us</a>
<br/>
Post tags: <a href="http://sebthom.de/tag/bug/" rel="nofollow tag">bug</a>, <a href="http://sebthom.de/tag/freeware/" rel="nofollow tag">My Freeware</a>, <a href="http://sebthom.de/tag/php/" rel="nofollow tag">PHP</a>, <a href="http://sebthom.de/tag/visual-basic/" rel="nofollow tag">Visual Basic</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://sebthom.de/23-mypad-php-editor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
