<?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>Leben des wolf-u.li &#187; MySQL</title>
	<atom:link href="http://wolf-u.li/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://wolf-u.li</link>
	<description>This and That.</description>
	<lastBuildDate>Thu, 29 Jul 2010 15:42:22 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/>		<item>
		<title>PHP-Bug des Jahres: Fehlende MySQL-Integration?</title>
		<link>http://wolf-u.li/2961/php-bug-des-jahres-fehlende-mysql-integration/</link>
		<comments>http://wolf-u.li/2961/php-bug-des-jahres-fehlende-mysql-integration/#comments</comments>
		<pubDate>Tue, 05 May 2009 17:04:08 +0000</pubDate>
		<dc:creator>Uli</dc:creator>
				<category><![CDATA[Infotech]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://wolf-u.li/?p=2961</guid>
		<description><![CDATA[Soeben bin ich bei php.net &#252;ber einen bug gesto&#223;en, bei dem ich deutlich grinsen musste. Konkret geht es um Bug #48139, in dem sich der Ersteller beschwert, dass er nach 12 Stunden Suche immer noch keine Integration von MySQL in PHP geschafft hatte. Leider ist er in seiner etwas r&#252;den Sprache ein wenig ungenau, was [...]]]></description>
			<content:encoded><![CDATA[<p>Soeben bin ich bei php.net &#252;ber einen bug gesto&#223;en, bei dem ich deutlich grinsen musste. Konkret geht es um Bug <a href="http://bugs.php.net/bug.php?id=48139">#48139</a>, in dem sich der Ersteller beschwert, dass er nach 12 Stunden Suche immer noch keine Integration von MySQL in PHP geschafft hatte. Leider ist er in seiner etwas r&#252;den Sprache ein wenig ungenau, was genau bei ihm fehlschl&#228;gt, aber insgesamt scheint sein PHP (&#252;brigens ungef&#228;hr das einzige PHP, welches sich so verh&#228;lt) keine der f&#252;r MySQL ben&#246;tigten .dlls zu laden. Hier der Screenshot des Bugs (nicht dass der mal abhanden kommt):<br />
<span id="more-2961"></span><br />
<div id="attachment_2962" class="wp-caption aligncenter" style="width: 375px"><a rel="lightbox" href="http://wolf-u.li/upload/2009/05/2961-php-bug-48139.png"><img src="http://wolf-u.li/upload/2009/05/2961-php-bug-48139-365x500.png" alt="PHP-Bug 48139" title="PHP-Bug 48139" width="365" height="500" class="size-medium wp-image-2962" /></a><p class="wp-caption-text">PHP-Bug 48139</p></div></p>
<hr /><small><center>&copy; 2005-2009 by <a href='http://wolf-u.li/'>Uli Wolf</a> &#8211; This Content is distributed under the <a href='http://wolf-u.li/pwnd-faq/'>Creative Commons License</a><br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites without attribution to the author and notification of the author breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. (Digital Fingerprint:  d2a576b5311479d89eff39b7ca886f6b)</center></small>]]></content:encoded>
			<wfw:commentRss>http://wolf-u.li/2961/php-bug-des-jahres-fehlende-mysql-integration/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SysCP 1.4.2 und 1.4.2.1 wurden released</title>
		<link>http://wolf-u.li/2905/syscp-142-und-1421-wurden-released/</link>
		<comments>http://wolf-u.li/2905/syscp-142-und-1421-wurden-released/#comments</comments>
		<pubDate>Tue, 21 Apr 2009 13:49:14 +0000</pubDate>
		<dc:creator>Uli</dc:creator>
				<category><![CDATA[Infotech]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Mailserver]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[SysCP]]></category>
		<category><![CDATA[Webserver]]></category>

		<guid isPermaLink="false">http://wolf-u.li/?p=2905</guid>
		<description><![CDATA[F&#252;r das Administrationstool SysCP ist im letzten Monat die neue Version 1.4.2 und kurz sp&#228;ter mit ein paar weiteren Bugfixes 1.4.2.1 erschienen. Leider hat in der Zwischenzeit ein Teammitglied das Projekt verlassen, weshalb der, mit 1.4 eingef&#252;hrte, Installer f&#252;r den Application Packaging Standard, leider derzeit ohne Maintainer ist.

Die konkreten &#196;nderungen f&#252;r 1.4.2:

Double menuentries for Billing [...]]]></description>
			<content:encoded><![CDATA[<p>F&#252;r das Administrationstool <a href="http://wolf-u.li/tag/syscp/">SysCP</a> ist im letzten Monat die neue Version <a href="https://forum.syscp.org/english-announcements/update-syscp-1-4-2-released/">1.4.2</a> und kurz sp&#228;ter mit ein paar weiteren Bugfixes <a href="https://forum.syscp.org/english-announcements/update-syscp-1-4-2-1-released/">1.4.2.1</a> erschienen. Leider hat in der Zwischenzeit ein Teammitglied das Projekt verlassen, weshalb der, mit 1.4 eingef&#252;hrte, Installer f&#252;r den <a href="https://wiki.syscp.org/docs/aps-handbook">Application Packaging Standard</a>, leider derzeit ohne Maintainer ist.<br />
<span id="more-2905"></span><br />
<strong>Die konkreten &#196;nderungen f&#252;r 1.4.2:</strong></p>
<ul>
<li>Double menuentries for Billing was shown (bug <a href="https://bugs.syscp.org/view.php?id=1003">1003</a>)</li>
<li>APS menu now shows up again (bug <a href="https://bugs.syscp.org/view.php?id=1002">1002</a>)</li>
<li>PHPMyAdmin/WebMail/WebFTP links in menu now show up again (bug <a href="https://bugs.syscp.org/view.php?id=1061">1061</a>)</li>
<li>PHP Configuration is again editable (bugs <a href="https://bugs.syscp.org/view.php?id=1024">1024</a>, <a href="https://bugs.syscp.org/view.php?id=1029">1029</a>, <a href="https://bugs.syscp.org/view.php?id=1031">1031</a>)</li>
<li>Several language mistakes in english language file were corrected (bug <a href="https://bugs.syscp.org/view.php?id=1070">1070</a>)</li>
<li>Protected areas with lighttpd work again (bug <a href="https://bugs.syscp.org/view.php?id=1050">1050</a>)</li>
<li>Awstats configuration page show all configs (bug <a href="https://bugs.syscp.org/view.php?id=1001">1001</a>)</li>
<li>Added missing line break to nss-mysql.cnf (bug <a href="https://bugs.syscp.org/view.php?id=1026">1026</a>)</li>
<li>Database query error by searching for ticket on categories page (bug <a href="https://bugs.syscp.org/view.php?id=1073">1073</a>)</li>
<li>Resellers weren&#8217;t able to manage instances of their customers (bug <a href="https://bugs.syscp.org/view.php?id=1088">1088</a>)</li>
<li>Autoresponder cron script didn&#8217;t ran because of short tags (bug <a href="https://bugs.syscp.org/view.php?id=1045">1045</a>)</li>
<li>Autoresponder didn&#8217;t remove the cron lockfile if module was disabled (bug <a href="https://bugs.syscp.org/view.php?id=1091">1091</a>)</li>
</ul>
<p><strong>Die &#196;nderungen f&#252;r 1.4.2.1:</strong></p>
<ul>
<li>Domain adding was case-insensitive, allowing same domain to be added multiple times (<a href="https://bugs.syscp.org/view.php?id=1057">1057</a>)</li>
<li>Domain panel pagination is faulty, shows too many pages (bug <a href="https://bugs.syscp.org/view.php?id=1157">1157</a>)</li>
<li>Adding one-letter-subdomains didn&#8217;t work (bug <a href="https://bugs.syscp.org/view.php?id=1064">1064</a>)</li>
<li>Wildcards are agin allowed in IP/Port configuration (bug <a href="https://bugs.syscp.org/view.php?id=1115">1115</a>)</li>
<li>When adding IP/Port combination: Listen Statement not set (bug <a href="https://bugs.syscp.org/view.php?id=1190">1190</a>)</li>
<li>Added Debian Lenny 5.0 Configfiles
<li>Unable to add one-letter-subdomains (bug <a href="https://bugs.syscp.org/view.php?id=1064">1064</a>)</li>
<li>It is not possible to add a forward as subdomain (bug <a href="https://bugs.syscp.org/view.php?id=1015">1015</a>)</li>
<li>Admin messages always bounced because of switched email/name (bug <a href="https://bugs.syscp.org/view.php?id=1160">1160</a>, <a href="https://bugs.syscp.org/view.php?id=1040">1040</a>)</li>
<li>E-Mail-Accounts with IDN-Domains now work again (you have to change your configuration) (bug <a href="https://bugs.syscp.org/view.php?id=1170">1170</a>)</li>
<li>Mail qouta in &#8220;email_quota_used&#8221; is not changed if mail account is deleted (bug <a href="https://bugs.syscp.org/view.php?id=1107">1107</a>)</li>
<li>Customer can disable mail quota (bug <a href="https://bugs.syscp.org/view.php?id=1100">1100</a>)</li>
<li>Number for email forwarders for customers not possible to set to unlimited (bug <a href="https://bugs.syscp.org/view.php?id=1158">1158</a>)</li>
<li>Fixed lots of warnings in php code (bug <a href="https://bugs.syscp.org/view.php?id=1044">1044</a>, <a href="https://bugs.syscp.org/view.php?id=1048">1048</a>, <a href="https://bugs.syscp.org/view.php?id=1141">1141</a>)</li>
<li>In new installations default dir for customers is now /var/customers (bug <a href="https://bugs.syscp.org/view.php?id=1191">1191</a>)</li>
<li>Dropdown list of path is not sorted alphabetically (bug <a href="https://bugs.syscp.org/view.php?id=1008">1008</a>)</li>
<li>Updated languagefiles (bug <a href="https://bugs.syscp.org/view.php?id=1124">1124</a>, <a href="https://bugs.syscp.org/view.php?id=1153">1153</a>, <a href="https://bugs.syscp.org/view.php?id=1099">1099</a>)</li>
<li>Many alias fixes in awstats/webalizer (bug <a href="https://bugs.syscp.org/view.php?id=1077">1077</a>, <a href="https://bugs.syscp.org/view.php?id=1076">1076</a>, <a href="https://bugs.syscp.org/view.php?id=1155">1155</a>, <a href="https://bugs.syscp.org/view.php?id=1118">1118</a>, <a href="https://bugs.syscp.org/view.php?id=1121">1121</a>)</li>
<li>Many fixes in the configfiles (bug <a href="https://bugs.syscp.org/view.php?id=1167">1167</a>, <a href="https://bugs.syscp.org/view.php?id=1164">1164</a>, <a href="https://bugs.syscp.org/view.php?id=1192">1192</a>, <a href="https://bugs.syscp.org/view.php?id=1069">1069</a>, <a href="https://bugs.syscp.org/view.php?id=1085">1085</a>, <a href="https://bugs.syscp.org/view.php?id=1161">1161</a>, <a href="https://bugs.syscp.org/view.php?id=1030">1030</a>, <a href="https://bugs.syscp.org/view.php?id=1103">1103</a>)</li>
<li>Keep default language when changed by user (bug <a href="https://bugs.syscp.org/view.php?id=1119">1119</a>)</li>
</ul>
<hr /><small><center>&copy; 2005-2009 by <a href='http://wolf-u.li/'>Uli Wolf</a> &#8211; This Content is distributed under the <a href='http://wolf-u.li/pwnd-faq/'>Creative Commons License</a><br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites without attribution to the author and notification of the author breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. (Digital Fingerprint:  d2a576b5311479d89eff39b7ca886f6b)</center></small>]]></content:encoded>
			<wfw:commentRss>http://wolf-u.li/2905/syscp-142-und-1421-wurden-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zend_DB: Datenbankverbindungen mit Zeichensatz UTF-8</title>
		<link>http://wolf-u.li/2893/zend_db-datenbankverbindungen-mit-zeichensatz-utf-8/</link>
		<comments>http://wolf-u.li/2893/zend_db-datenbankverbindungen-mit-zeichensatz-utf-8/#comments</comments>
		<pubDate>Sat, 11 Apr 2009 23:48:18 +0000</pubDate>
		<dc:creator>Uli</dc:creator>
				<category><![CDATA[Infotech]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://wolf-u.li/?p=2893</guid>
		<description><![CDATA[Ein leidiges Problem im Webdevelopment sind die verschiedenen Zeichens&#228;tze. Viele Anbieter von Datenbanken setzen latin-1 als Standard, was gerade bei Seiten, die sich voll international ausrichten wollen, ein wenig Probleme bereiten kann. Oft f&#252;hrt das zu defekten Ausgaben. In diesem Beitrag m&#246;chte ich ein paar L&#246;sungen f&#252;r das Problem aufzeigen und zum Schluss die L&#246;sung [...]]]></description>
			<content:encoded><![CDATA[<p>Ein leidiges Problem im Webdevelopment sind die verschiedenen Zeichens&#228;tze. Viele Anbieter von Datenbanken setzen latin-1 als Standard, was gerade bei Seiten, die sich voll international ausrichten wollen, ein wenig Probleme bereiten kann. Oft f&#252;hrt das zu defekten Ausgaben. In diesem Beitrag m&#246;chte ich ein paar L&#246;sungen f&#252;r das Problem aufzeigen und zum Schluss die L&#246;sung anhand des <a href="http://wolf-u.li/tag/zend-framework/">Zend Framework</a> kurz zeigen.<br />
<span id="more-2893"></span><br />
F&#252;r die Extension <em>mysql</em> kann man nat&#252;rlich einfach mittels:</p>
<div class="igBar"><span id="lcode-6"><a href="#" onclick="javascript:showPlainTxt('code-6'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-6">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mysql_set_charset<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'utf8'</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p>
die Verbindung nach dem Verbindungsaufbau auf UTF-8 umstellen. pdo_mysql ist nicht viel komplizierter:</p>
<div class="igBar"><span id="lcode-7"><a href="#" onclick="javascript:showPlainTxt('code-7'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-7">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$db = new PDO<span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#CC0000;">"mysql:host=localhost;dbname=DEINEDATENBANK"</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#CC0000;">'DEINNUTZERNAME'</span>, <span style="color:#CC0000;">'DEINPASSWORT'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; array<span style="color:#006600; font-weight:bold;">&#40;</span>PDO::<span style="">MYSQL_ATTR_INIT_COMMAND</span> =&gt; <span style="color:#CC0000;">"SET NAMES utf8"</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p>
Leider gibt das Probleme, wenn das verwendete Framework f&#252;r die Datenbankverbindung Lazy-Connection verwendet bei dem die Verbindung zum Server zu Beginn der Laufzeit definiert, jedoch erst bei ersten eingehenden Query ge&#246;ffnet wird.<br />
Da ich gerne mit Zend Framework und pdo_mysql arbeite, gibt es einen trick, wie man trotzdem  die Verbindung auf UTF-8 umschalten kann:</p>
<div class="igBar"><span id="lcode-8"><a href="#" onclick="javascript:showPlainTxt('code-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-8">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$params = array<span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#CC0000;">'host'</span> =&gt; <span style="color:#CC0000;">'localhost'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#CC0000;">'username'</span> =&gt; <span style="color:#CC0000;">'DEINNUTZERNAME'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#CC0000;">'password'</span> =&gt; <span style="color:#CC0000;">'DEINPASSWORT'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#CC0000;">'dbname'</span> =&gt; <span style="color:#CC0000;">'DEINEDATENBANK'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#CC0000;">'driver_options'</span> =&gt; array<span style="color:#006600; font-weight:bold;">&#40;</span>PDO::<span style="">MYSQL_ATTR_INIT_COMMAND</span> =&gt; <span style="color:#CC0000;">'SET NAMES UTF8;'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$db = Zend_Db::<span style="">factory</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'PDO_MYSQL'</span>, $params<span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Dies kann nat&#252;rlich im Konfigurationsteil noch etwas verfeinert werden, aber ich denke, die Idee ist klar.</p>
<p><strong>UPDATE:</strong><br />
In <a href="http://framework.zend.com/manual/de/zend.application.available-resources.html">Zend_Application</a> k&#246;nnte die INI-Config so aussehen:</p>
<div class="igBar"><span id="lcode-9"><a href="#" onclick="javascript:showPlainTxt('code-9'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-9">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>production<span style="color:#006600; font-weight:bold;">&#93;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">resources.<span style="">db</span>.<span style="">adapter</span> = <span style="color:#CC0000;">"pdo_mysql"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">resources.<span style="">db</span>.<span style="">params</span>.<span style="">host</span> = <span style="color:#CC0000;">"localhost"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">resources.<span style="">db</span>.<span style="">params</span>.<span style="">username</span> = <span style="color:#CC0000;">"DEINNUTZERNAME"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">resources.<span style="">db</span>.<span style="">params</span>.<span style="">password</span> = <span style="color:#CC0000;">"DEINPASSWORT"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">resources.<span style="">db</span>.<span style="">params</span>.<span style="">dbname</span> = <span style="color:#CC0000;">"DEINEDATENBANK"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">resources.<span style="">db</span>.<span style="">params</span>.<span style="">driver_options</span>.<span style="color:#800000;color:#800000;">1002</span> = <span style="color:#CC0000;">"SET NAMES UTF8;"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">resources.<span style="">db</span>.<span style="">isDefaultTableAdapter</span> = true </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Update #2:<br />
Zend Framework 1.8 bringt f&#252;r alle unterst&#252;tzten Datenbankadapter <a href="http://framework.zend.com/issues/browse/ZF-1541">mittlerweile</a> charset-support mit sich, der wie folgt aussieht:</p>
<div class="igBar"><span id="lcode-10"><a href="#" onclick="javascript:showPlainTxt('code-10'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-10">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>production<span style="color:#006600; font-weight:bold;">&#93;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">resources.<span style="">db</span>.<span style="">adapter</span> = <span style="color:#CC0000;">"pdo_mysql"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">resources.<span style="">db</span>.<span style="">params</span>.<span style="">host</span> = <span style="color:#CC0000;">"localhost"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">resources.<span style="">db</span>.<span style="">params</span>.<span style="">username</span> = <span style="color:#CC0000;">"DEINNUTZERNAME"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">resources.<span style="">db</span>.<span style="">params</span>.<span style="">password</span> = <span style="color:#CC0000;">"DEINPASSWORT"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">resources.<span style="">db</span>.<span style="">params</span>.<span style="">dbname</span> = <span style="color:#CC0000;">"DEINEDATENBANK"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">resources.<span style="">db</span>.<span style="">params</span>.<span style="">charset</span> = utf8</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">resources.<span style="">db</span>.<span style="">isDefaultTableAdapter</span> = true </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<hr /><small><center>&copy; 2005-2009 by <a href='http://wolf-u.li/'>Uli Wolf</a> - This Content is distributed under the <a href='http://wolf-u.li/pwnd-faq/'>Creative Commons License</a><br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites without attribution to the author and notification of the author breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. (Digital Fingerprint:  d2a576b5311479d89eff39b7ca886f6b)</center></small>]]></content:encoded>
			<wfw:commentRss>http://wolf-u.li/2893/zend_db-datenbankverbindungen-mit-zeichensatz-utf-8/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>phpMyAdmin: Linker Frame zeigt &#8220;Keine Datenbanken&#8221; obwohl korrekte Rechte vorhanden</title>
		<link>http://wolf-u.li/2457/phpmyadmin-linker-frame-zeigt-keine-datenbanken-obwohl-korrekte-rechte-vorhanden/</link>
		<comments>http://wolf-u.li/2457/phpmyadmin-linker-frame-zeigt-keine-datenbanken-obwohl-korrekte-rechte-vorhanden/#comments</comments>
		<pubDate>Sun, 18 Jan 2009 12:26:55 +0000</pubDate>
		<dc:creator>Uli</dc:creator>
				<category><![CDATA[Infotech]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://wolf-u.li/?p=2457</guid>
		<description><![CDATA[Ich habe gestern mal meine phpmyadmin-Installation komplett entfernt und alles neu installiert, da ich selbst bei fehlenden Rechten immer den Datenbanknamen im linken Frame angezeigt bekommen habe. Daraufhin wurde links im Frame gar nichts mehr angezeigt, sondern nur noch der Text "Keine Datenbanken".
Die L&#246;sung war einfach: Ich hatte in einem Anfall geistiger Umnachtung in der [...]]]></description>
			<content:encoded><![CDATA[<p>Ich habe gestern mal meine phpmyadmin-Installation komplett entfernt und alles neu installiert, da ich selbst bei fehlenden Rechten immer den Datenbanknamen im linken Frame angezeigt bekommen habe. Daraufhin wurde links im Frame gar nichts mehr angezeigt, sondern nur noch der Text "Keine Datenbanken".<br />
Die L&#246;sung war einfach: Ich hatte in einem Anfall geistiger Umnachtung in der my.cnf des MySQL-Servers den Punkt</p>
<blockquote><p>skip-show-database</p></blockquote>
<p>eingetragen, was dazu f&#252;hrte, dass phpmyadmin die Datenbanken nat&#252;rlich nicht mehr anzeigen konnte. Diese Zeile ge&#228;ndert auf (auskommentiert):</p>
<blockquote><p>#skip-show-database</p></blockquote>
<p>und schon liefs wieder wie gew&#252;nscht <img src='http://wolf-u.li/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<hr /><small><center>&copy; 2005-2009 by <a href='http://wolf-u.li/'>Uli Wolf</a> - This Content is distributed under the <a href='http://wolf-u.li/pwnd-faq/'>Creative Commons License</a><br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites without attribution to the author and notification of the author breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. (Digital Fingerprint:  d2a576b5311479d89eff39b7ca886f6b)</center></small>]]></content:encoded>
			<wfw:commentRss>http://wolf-u.li/2457/phpmyadmin-linker-frame-zeigt-keine-datenbanken-obwohl-korrekte-rechte-vorhanden/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Passwort eines Benutzers in MySQL &#228;ndern</title>
		<link>http://wolf-u.li/1973/passwort-eines-benutzers-in-mysql-aendern/</link>
		<comments>http://wolf-u.li/1973/passwort-eines-benutzers-in-mysql-aendern/#comments</comments>
		<pubDate>Tue, 07 Oct 2008 08:07:28 +0000</pubDate>
		<dc:creator>Uli</dc:creator>
				<category><![CDATA[Infotech]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://wolf-u.li/?p=1973</guid>
		<description><![CDATA[Nur ein kurzer Beitrag, weil das Thema hier grad durch die Reihen ging.
Das Passwort von MySQL-Nutzern kann man standardm&#228;&#223;ig &#252;ber zwei Wege &#228;ndern. Entweder in der MySQL-Konsole:
PLAIN TEXT
CODE:




UPDATE user SET Password = PASSWORD&#40; 'YOURPASSWORD' &#41; WHERE User = 'YOURUSER' AND Host = 'YOURHOST';


FLUSH PRIVIEGES; 






Wobei YOURUSER,YOURPASSWORD und YOURHOST durch die gew&#252;nschten Werte zu ersetzen sind. [...]]]></description>
			<content:encoded><![CDATA[<p>Nur ein kurzer Beitrag, weil das Thema hier grad durch die Reihen ging.</p>
<p>Das Passwort von MySQL-Nutzern kann man standardm&#228;&#223;ig &#252;ber zwei Wege &#228;ndern. Entweder in der MySQL-Konsole:</p>
<div class="igBar"><span id="lcode-13"><a href="#" onclick="javascript:showPlainTxt('code-13'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-13">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">UPDATE user SET Password = PASSWORD<span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color:#CC0000;">'YOURPASSWORD'</span> <span style="color:#006600; font-weight:bold;">&#41;</span> WHERE User = <span style="color:#CC0000;">'YOURUSER'</span> AND Host = <span style="color:#CC0000;">'YOURHOST'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">FLUSH PRIVIEGES; </div>
</li>
</ol>
</div>
</div>
</div>
<p>
Wobei <em>YOURUSER</em>,<em>YOURPASSWORD</em> und <em>YOURHOST</em> durch die gew&#252;nschten Werte zu ersetzen sind. Wenn alle Hosts eines Nutzers ge&#228;ndert werden sollen, dann kann man die Bedingung <code>AND Host='YOURHOST'</code> entfernen.</p>
<p>Die andere M&#246;glichkeit ist &#252;ber den <code>mysqladmin</code>:</p>
<div class="igBar"><span id="lcode-14"><a href="#" onclick="javascript:showPlainTxt('code-14'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-14">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mysqladmin --user=YOURUSER --password=YOUROLDPASSWORD password YOURPASSWORD<span style="color:#CC0000;">" </span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
Wobei <em>YOURUSER</em> und <em>YOURPASSWORD</em> durch die gew&#252;nschten Werte zu ersetzen sind und <em>YOUROLDPASSWORD</em> das bisherige Passwort sein muss.</p>
<hr /><small><center>&copy; 2005-2009 by <a href='http://wolf-u.li/'>Uli Wolf</a> - This Content is distributed under the <a href='http://wolf-u.li/pwnd-faq/'>Creative Commons License</a><br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites without attribution to the author and notification of the author breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. (Digital Fingerprint:  d2a576b5311479d89eff39b7ca886f6b)</center></small>]]></content:encoded>
			<wfw:commentRss>http://wolf-u.li/1973/passwort-eines-benutzers-in-mysql-aendern/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>phpMyAdmin auf dem Conceptronic CH3SNAS bzw. D-Link DNS-323 installieren</title>
		<link>http://wolf-u.li/1640/phpmyadmin-auf-dem-conceptronic-ch3snas-bzw-d-link-dns-323-installieren/</link>
		<comments>http://wolf-u.li/1640/phpmyadmin-auf-dem-conceptronic-ch3snas-bzw-d-link-dns-323-installieren/#comments</comments>
		<pubDate>Fri, 11 Jul 2008 07:28:50 +0000</pubDate>
		<dc:creator>Uli</dc:creator>
				<category><![CDATA[Gadgets]]></category>
		<category><![CDATA[CH3SNAS]]></category>
		<category><![CDATA[Conceptronic]]></category>
		<category><![CDATA[D-Link]]></category>
		<category><![CDATA[DNS-323]]></category>
		<category><![CDATA[fun_plug]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[NAS]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://wolf-u.li/?p=1640</guid>
		<description><![CDATA[phpMyAdmin ist eines der am h&#228;ufigst verwendeten Administrationstools f&#252;r MySQL-Datenbanken. Leider hat auf meinem CH3SNAS phpMyAdmin nicht auf Anhieb funktioniert. Der Trick ist jedoch recht einfach.

Diese Anleitung bezieht sich auf das fun_plug der Version 0.5.Die Anweisungen k&#246;nnen aber auch mit fr&#252;heren Versionen funktionieren.
Nat&#252;rlich muss zun&#228;chst das fun_plug und MySQL sowie PHP installiert werden.
Nun muss man [...]]]></description>
			<content:encoded><![CDATA[<p>phpMyAdmin ist eines der am h&#228;ufigst verwendeten Administrationstools f&#252;r MySQL-Datenbanken. Leider hat auf meinem CH3SNAS phpMyAdmin nicht auf Anhieb funktioniert. Der Trick ist jedoch recht einfach.<br />
<span id="more-1640"></span></p>
<div class="wolfuliannounce">Diese Anleitung bezieht sich auf das <a href="http://wolf-u.li/tag/fun_plug/">fun_plug</a> der Version 0.5.<br />Die Anweisungen k&#246;nnen aber auch mit fr&#252;heren Versionen funktionieren.</div>
<p>Nat&#252;rlich muss zun&#228;chst das <a href="http://wolf-u.li/1426/fun_plug-05-auf-dem-conceptronic-ch3snas-bzw-d-link-dns-323-installieren/">fun_plug</a> und <a href="http://wolf-u.li/1425/php-und-mysql-auf-dem-conceptronic-ch3snas-bzw-d-link-dns-323-installieren/">MySQL sowie PHP</a> installiert werden.</p>
<p>Nun muss man den aktuellen phpMyAdmin herunterladen. Diesen gibt es auf <a href="http://phpmyadmin.sf.net">Sourceforge</a> zum Download. Aktuell ist momentan (05.02.2010) beispielsweise die Version 3.2.5.</p>
<div class="igBar"><span id="lcode-17"><a href="#" onclick="javascript:showPlainTxt('code-17'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-17">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">cd /srv/www/pages/</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">wget http:<span style="color:#FF9933; font-style:italic;">//switch.dl.sourceforge.net/sourceforge/phpmyadmin/phpMyAdmin-3.2.5-all-languages.tar.gz</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">tar xfz phpMyAdmin-<span style="color:#800000;color:#800000;">3</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">5</span>-all-languages.<span style="">tar</span>.<span style="">gz</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">rm phpMyAdmin-<span style="color:#800000;color:#800000;">3</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">5</span>-all-languages.<span style="">tar</span>.<span style="">gz</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mv phpMyAdmin-<span style="color:#800000;color:#800000;">3</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">5</span>-all-languages phpmyadmin </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Nachdem man das aktuelle Paket im Webroot des lighttpd entpackt hat, kann man sich an die Konfiguration machen. Am schnellsten geht dies &#252;ber die Konsole. Editiere die Datei <code>config.inc.php</code> im Verzeichnis <code>phpmyadmin</code>, sodass diese wie unten aussieht:</p>
<div class="igBar"><span id="lcode-18"><a href="#" onclick="javascript:showPlainTxt('code-18'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-18">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">/* Servers configuration */</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$i = <span style="color:#800000;color:#800000;">0</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">/* Server localhost */</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$i++;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$cfg<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'Servers'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span>$i<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'host'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#CC0000;">'localhost'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$cfg<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'Servers'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span>$i<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'extension'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#CC0000;">'mysql'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$cfg<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'Servers'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span>$i<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'connect_type'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#CC0000;">'tcp'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$cfg<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'Servers'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span>$i<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'compress'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = false;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$cfg<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'Servers'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span>$i<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'auth_type'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#CC0000;">'http'</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p>
<small>Hinweis: Die PHP-Tags (&lt;?php und ?&gt;) sind nat&#252;rlich nicht zu vergessen</small></p>
<p>Und schon ist phpMyAdmin &#252;ber <code>http://<Adresse des NAS>/phpmyadmin/</code> zu erreichen. Passwort und Nutzername sind oft w&#228;hrend der Einrichtung gesetzt worden, zumeist ist der Nutzername "<code>root</code>".</p>
<p>Bei der Konfiguration ist folgendes zu bemerken:</p>
<ul>
<li>Authentifizierungsmethode: <strong>http</strong>, da <em>cookie</em> ohne die PHP-Extension <em>mcrypt</em> phpMyAdmin stark verlangsamt.</li>
<li>Wenn der Fehler: <code>#2002 - Der Server antwortet nicht. (evtl. ist auch der Socket des lokalen MySQL-Servers socket nicht korrekt konfiguriert)</code> auftritt, muss der Servername von <code>localhost</code> auf <strong>127.0.0.1</strong> gesetzt werden, damit phpMyAdmin connecten kann. Achtung: Dann muss aber auch "skip-networking" von MySQL deaktiviert sein.</li>
</ul>
<p><strong>Changelog des Eintrags:</strong></p>
<ul>
<li>09.10.2008: &#220;berarbeitung passend zum Update des <a href="http://wolf-u.li/1425/php-und-mysql-auf-dem-conceptronic-ch3snas-bzw-d-link-dns-323-installieren/">lighttpd &#038; MySQL-Eintrags</a>.</li>
<li>23.11.2008: Neue Versionsnummer 3.0.1.1</li>
<li>17.01.2009: Neue Versionsnummer 3.1.1</li>
<li>05.02.2010: Neue Versionsnummer 3.2.5</li>
</ul>
<hr /><small><center>&copy; 2005-2009 by <a href='http://wolf-u.li/'>Uli Wolf</a> - This Content is distributed under the <a href='http://wolf-u.li/pwnd-faq/'>Creative Commons License</a><br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites without attribution to the author and notification of the author breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. (Digital Fingerprint:  d2a576b5311479d89eff39b7ca886f6b)</center></small>]]></content:encoded>
			<wfw:commentRss>http://wolf-u.li/1640/phpmyadmin-auf-dem-conceptronic-ch3snas-bzw-d-link-dns-323-installieren/feed/</wfw:commentRss>
		<slash:comments>73</slash:comments>
		</item>
		<item>
		<title>PHP und MySQL auf dem Conceptronic CH3SNAS bzw. D-Link DNS-323 installieren</title>
		<link>http://wolf-u.li/1425/php-und-mysql-auf-dem-conceptronic-ch3snas-bzw-d-link-dns-323-installieren/</link>
		<comments>http://wolf-u.li/1425/php-und-mysql-auf-dem-conceptronic-ch3snas-bzw-d-link-dns-323-installieren/#comments</comments>
		<pubDate>Sat, 05 Jul 2008 22:42:58 +0000</pubDate>
		<dc:creator>Uli</dc:creator>
				<category><![CDATA[Gadgets]]></category>
		<category><![CDATA[CH3SNAS]]></category>
		<category><![CDATA[Conceptronic]]></category>
		<category><![CDATA[D-Link]]></category>
		<category><![CDATA[DNS-323]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Webserver]]></category>

		<guid isPermaLink="false">http://wolf-u.li/?p=1425</guid>
		<description><![CDATA[Diese Anleitung bezieht sich auf das fun_plug der Version 0.5.Die Anleitung f&#252;r 0.3 und 0.4 befindet sich hier.
Nach meinem Artikel &#252;ber die Installation von PHP5.2 zusammen mit dem Webserver lighttpd gehe ich nun einen Schritt weiter. Es geht konkret um die Installation von MySQL5.1 inklusive PHP5.2 zusammen mit dem Webserver lighttpd auf dem NAS.

Voraussetzung f&#252;r [...]]]></description>
			<content:encoded><![CDATA[<div class="wolfuliannounce">Diese Anleitung bezieht sich auf das <a href="http://wolf-u.li/tag/fun_plug/">fun_plug</a> der Version 0.5.<br />Die Anleitung f&#252;r 0.3 und 0.4 befindet sich <a href="http://wolf-u.li/760/webserver-lighttpd-mit-php52-auf-dem-conceptronic-ch3snas-installieren/">hier</a>.</div>
<p>Nach meinem Artikel &#252;ber die Installation von <a href="http://wolf-u.li/760/webserver-lighttpd-mit-php52-auf-dem-conceptronic-ch3snas-installieren/">PHP5.2 zusammen mit dem Webserver lighttpd</a> gehe ich nun einen Schritt weiter. Es geht konkret um die Installation von <a href="http://wolf-u.li/tag/mysql/">MySQL</a>5.1 inklusive <a href="http://wolf-u.li/tag/php/">PHP</a>5.2 zusammen mit dem <a href="http://wolf-u.li/tag/webserver/">Webserver</a> lighttpd auf dem NAS.<br />
<span id="more-1425"></span><br />
Voraussetzung f&#252;r die Installation ist die Einrichtung des fun_plug in der Version 0.5, welche <a href="http://wolf-u.li/1426/fun_plug-05-auf-dem-conceptronic-ch3snas-bzw-d-link-dns-323-installieren/">hier</a> oder <a href="http://wolf-u.li/1318/fun_plug-05-auf-dem-usb-stick-am-conceptronic-ch3snas-bzw-d-link-dns-323-betrieben/">hier</a> (USB-Stick-Version) zu finden ist. F&#252;r alle Listings in diesem Beitrag gilt: Wenn man auf "Plain Text" klickt, gehts kopieren leichter <img src='http://wolf-u.li/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  Und wenn Pfade abge&#228;ndert werden sollen, bitte selbstst&#228;ndig anpassen.</p>
<p>Der Macher des fun_plug, fonz, hat die Pakete lighttpd, PHP und MySQL in seinem Repository dem Update vom 24. August bereitgestellt. Der Webserver lighttpd wird bereits mit dem fun_plug installiert (jedoch nicht aktiviert), die beiden Pakete f&#252;r PHP und MySQL m&#252;ssen noch auf das NAS heruntergeladen werden. Dazu muss man das Repository von fonz und <a href="http://wolf-u.li/2146/ulis-paket-repository-fuer-das-conceptronic-ch3snas-bzw-d-link-dns-323/">mir</a> wie gewohnt syncronisieren.</p>
<p>Wenn man (so wie im <a href="http://wolf-u.li/1426/fun_plug-05-auf-dem-conceptronic-ch3snas-bzw-d-link-dns-323-installieren/">ffp0.5-Tutorial</a> beschrieben) bereits fr&#252;her einmal das PHP von fonz installiert hat, so muss man dieses mittels "<code>funpkg -u</code>" nun upgraden. </p>
<p>Normalerweise wird man die beiden Pakete wie folgt installieren, zus&#228;tzlich ben&#246;tigt man <code>curl</code>:
<div class="igBar"><span id="lcode-31"><a href="#" onclick="javascript:showPlainTxt('code-31'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-31">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">funpkg -i /ffp/pkg/packages/mysql-*.<span style="">tgz</span> funpkg -i /ffp/pkg/additional<span style="color:#008000;">/*/curl-*.tgz funpkg -i /ffp/pkg/additional/*/</span>php-*.<span style="">tgz</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p> </p>
<p>Alle Webdienste werden in Zukunft das Verzeichnis <code>/srv/</code> als Datenablageort nutzen. Da es unklug w&#228;re, diese Speicherort auf dem kleinen RAM des NAS zu erzeugen, werden wir nun erstmal einen Link zu einem Verzeichnis auf der Festplatte oder dem USB-Stick erstellen. In meinem Beispiel werde ich /srv auf meinem USB-Stick linken. Dazu &#246;ffnet man die Datei <code>/ffp/etc/fun_plug.init</code> und f&#252;gt am Ende folgendes ein:</p>
<div class="igBar"><span id="lcode-32"><a href="#" onclick="javascript:showPlainTxt('code-32'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-32">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># create custom link to the server-folder</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ln -s /mnt/HD_a2/usbstorage/srv/ /srv </div>
</li>
</ol>
</div>
</div>
</div>
<p>
Den letzten Befehl f&#252;hren wir nun auch gleich auf der Konsole aus, damit der Link erstellt wird. Zun&#228;chst erstellen wir jedoch das Verlinkte Verzeichnis:</p>
<div class="igBar"><span id="lcode-33"><a href="#" onclick="javascript:showPlainTxt('code-33'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-33">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mkdir /mnt/HD_a2/usbstorage/srv/</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ln -s /mnt/HD_a2/usbstorage/srv/ /srv </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Der Webserver lighttpd muss noch konfiguriert werden, damit auch dieser auf die richtigen Verzeichnisse zugreift. Ein Beispiel f&#252;r eine Config liefert fonz bereits mit; diese wird nun genutzt. Ich lasse mittels <a href="http://wolf-u.li/1413/rekursives-suchen-und-ersetzen-mit-sed/">sed</a> die Pfade korrekt ersetzen.</p>
<div class="igBar"><span id="lcode-34"><a href="#" onclick="javascript:showPlainTxt('code-34'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-34">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">cp /ffp/etc/examples/lighttpd.<span style="">conf</span>-with-php /ffp/etc/lighttpd.<span style="">conf</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sed -i <span style="color:#CC0000;">'s!/mnt/HD_a2/!/srv/!g'</span> /ffp/etc/lighttpd.<span style="">conf</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Damit php auch wei&#223;, was erlaubt oder verboten ist, muss eine php.ini im Verzeichnis /ffp/etc/ liegen. Diese kann man entweder wie die <code>lighttpd.conf</code> aus dem Verzeichnis <code>/ffp/etc/examples</code> kopieren oder direkt eine verbesserte (Siehe Kommentare) herunterladen:</p>
<div class="igBar"><span id="lcode-35"><a href="#" onclick="javascript:showPlainTxt('code-35'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-35">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">wget http:<span style="color:#FF9933; font-style:italic;">//wolf-u.li/download-manager.php?id=16 -O /ffp/etc/php.ini </span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
Und die my.cnf von MySQL darf nat&#252;rlich nicht fehlen:</p>
<div class="igBar"><span id="lcode-36"><a href="#" onclick="javascript:showPlainTxt('code-36'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-36">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">cp /ffp/etc/examples/mysql/my-small.<span style="">cnf</span> /ffp/etc/my.<span style="">cnf</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Nun befinden sich die drei wichtigen Dateien php.ini (Konfiguration von PHP), lighttpd.conf (Konfiguration f&#252;r den Webserver) sowie my.cnf (Konfiguration des MySQL-Servers) im Verzeichnis /ffp/etc/<br />
Prinzipiell sollten alle Configs mal durchgesehen werden, ob die Werte so okay sind.</p>
<p>Der Webroot des Webservers ist direkt auf /srv/www/ gelegt, dort muss man nun die entsprechenden Verzeichnisse erstellen:</p>
<div class="igBar"><span id="lcode-37"><a href="#" onclick="javascript:showPlainTxt('code-37'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-37">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mkdir -p /srv/tmp/</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mkdir -p /srv/www/logs</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mkdir -p /srv/www/pages </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Die MySQL-Datenbank muss noch initialisiert werden mittels der folgenden Befehle:</p>
<div class="igBar"><span id="lcode-38"><a href="#" onclick="javascript:showPlainTxt('code-38'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-38">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mysql_install_db</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sh /ffp/start/mysqld.<span style="">sh</span> start</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">/ffp/bin/mysql_secure_installation </div>
</li>
</ol>
</div>
</div>
</div>
<p>
Dort wird nun nach dem Passwort gefragt: "<code>Enter current password for root (enter for none):</code>" Bei einer neuen Installation ist dieses einfach leer!</p>
<p>Nun kann man den Webserver mal starten:</p>
<div class="igBar"><span id="lcode-39"><a href="#" onclick="javascript:showPlainTxt('code-39'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-39">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sh /ffp/start/lighttpd.<span style="">sh</span> start </div>
</li>
</ol>
</div>
</div>
</div>
<p>
Sollte dieser schon laufen, muss der Befehl <code>start</code> durch <code>restart</code> ersetzt werden.</p>
<p>Sollte alles glatt gehen, so kann man die Pakete im fun_plug dauerhaft aktivieren:</p>
<div class="igBar"><span id="lcode-40"><a href="#" onclick="javascript:showPlainTxt('code-40'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-40">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">chmod a+x /ffp/start/lighttpd.<span style="">sh</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">chmod a+x /ffp/start/mysqld.<span style="">sh</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Kleiner Hinweis am Rand: Der Webserver startet bis jetzt auf Port 8080. M&#246;chte man diesen auf Port 80 (also den regul&#228;ren HTTP-Port) legen, so muss man folgende Befehle ausf&#252;hren:</p>
<div class="igBar"><span id="lcode-41"><a href="#" onclick="javascript:showPlainTxt('code-41'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-41">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sed -i <span style="color:#CC0000;">'/server.port/ s/^/#/'</span> /ffp/etc/lighttpd.<span style="">conf</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">chmod a+x /ffp/start/kickwebs.<span style="">sh</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
Dies bewirkt, dass der interne Webserver f&#252;r die Weboberfl&#228;che gekillt wird, anschlie&#223;end startet lighttpd und legt sich auf Port 80. Der interne Webserver ist ein paar Minuten sp&#228;ter dann auf Port 81 wieder verf&#252;gbar.</p>
<p><a name="extensions" href="#extensions"></a>Standardm&#228;&#223;ig sind in meiner PHP.ini derzeit die untenstehenden Extensions aktiviert. Danke an <a href="http://wolf-u.li/1640/phpmyadmin-auf-dem-conceptronic-ch3snas-bzw-d-link-dns-323-installieren/#comment-11500">Peter</a> f&#252;r den Hinweis!</p>
<p>Einzelne Extensions kann man problemlos auch deaktivieren oder eventuell auch neue hinzuf&#252;gen (bitte per Kommentar melden, wenn eine fehlt!). Welche momentan &#252;berhaupt verf&#252;gbar sind, bekommt man mittels "<code>ls -al /ffp/lib/php/extensions/no-debug-non-zts-20060613/</code>" heraus. Dann sucht man den Punkt "Dynamic Extensions" in der /ffp/etc/php.ini und kommentiert dort die Extensions ein oder aus. Beispielhaft hier mbstring aktiviert:</p>
<div class="igBar"><span id="lcode-42"><a href="#" onclick="javascript:showPlainTxt('code-42'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-42">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">extension=mbstring.<span style="">so</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Momentan sind folgende verf&#252;gbar und aktiviert:</p>
<blockquote><p><code>calendar<br />
ctype<br />
ftp<br />
gd<br />
mbstring<br />
mysql<br />
pdo<br />
pdo_mysql<br />
pdo_sqlite<br />
sqlite<br />
tokenizer<br />
zlib</code></p></blockquote>
<p><strong>Changelog des Eintrags</strong>:<br />
09.10.2008 - 01:30</p>
<ul>
<li>Update: Umstieg auf fonz' Pakete.</li>
<li>Umstellung des Webroots auf /srv/</li>
<li>Cleanup der php.ini</li>
<li>Anpassung aller Pfade</li>
</ul>
<hr /><small><center>&copy; 2005-2009 by <a href='http://wolf-u.li/'>Uli Wolf</a> - This Content is distributed under the <a href='http://wolf-u.li/pwnd-faq/'>Creative Commons License</a><br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites without attribution to the author and notification of the author breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. (Digital Fingerprint:  d2a576b5311479d89eff39b7ca886f6b)</center></small>]]></content:encoded>
			<wfw:commentRss>http://wolf-u.li/1425/php-und-mysql-auf-dem-conceptronic-ch3snas-bzw-d-link-dns-323-installieren/feed/</wfw:commentRss>
		<slash:comments>136</slash:comments>
		</item>
		<item>
		<title>Einfaches MySQL-Backup mit Pruning und Verschl&#252;sselung mittels bash &amp; rsync</title>
		<link>http://wolf-u.li/1291/einfaches-mysql-backup-mit-pruning-und-verschluesselung-mittels-bash-rsync/</link>
		<comments>http://wolf-u.li/1291/einfaches-mysql-backup-mit-pruning-und-verschluesselung-mittels-bash-rsync/#comments</comments>
		<pubDate>Mon, 02 Jun 2008 19:47:32 +0000</pubDate>
		<dc:creator>Uli</dc:creator>
				<category><![CDATA[Infotech]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Rsync]]></category>

		<guid isPermaLink="false">http://wolf-u.li/?p=1291</guid>
		<description><![CDATA[Vor einiger Zeit habe ich f&#252;r meine Server ein MySQL-Backup-Script geschrieben, welches alle Datenbanken einzeln in verschl&#252;sselte Dateien dumpt und diese per rsync auf einen Server oder in ein anderes Verzeichnis kopiert. Warum eigentlich mit Verschl&#252;sselung wird sich nun der ein oder andere fragen? Nun mein Serveranbieter legt zu meinem Root-Server einen Backup-Space bei, der [...]]]></description>
			<content:encoded><![CDATA[<p>Vor einiger Zeit habe ich f&#252;r meine Server ein MySQL-Backup-Script geschrieben, welches alle Datenbanken einzeln in verschl&#252;sselte Dateien dumpt und diese per rsync auf einen Server oder in ein anderes Verzeichnis kopiert. Warum eigentlich mit Verschl&#252;sselung wird sich nun der ein oder andere fragen? Nun mein Serveranbieter legt zu meinem Root-Server einen Backup-Space bei, der wahlweise per FTP, Rsync oder Samba erreichbar ist. Da ich einige Features von rsync, wie beispielsweise abgleich eines lokalen Verzeichnisses mit einem entfernten (auch mit L&#246;schen von Dateien, wenn diese am Ausgangsort nicht mehr existieren), sch&#228;tze, habe ich mich f&#252;r diesen Weg entschieden. Vielleicht ist dieses Script nicht das eleganteste, aber es funktioniert seit etlichen Monaten bestens und etliche Restores haben auch schon bewiesen, dass es n&#246;tig ist.<br />
<span id="more-1291"></span><br />
Zun&#228;chst das Script, unten folgen die Erkl&#228;rungen und Anweisungen zur Benutzung:</p>
<div class="igBar"><span id="lcode-46"><a href="#" onclick="javascript:showPlainTxt('code-46'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-46">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#!/bin/bash</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">BACKUPPATH=<span style="color:#CC0000;">"/YOURDIR/"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">DELOLDERTHAN=$<span style="color:#006600; font-weight:bold;">&#40;</span>date --date <span style="color:#CC0000;">'-10 Days'</span> +%s<span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">MYSQLUSER=<span style="color:#CC0000;">"YOURLUSER"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">MYSQLPASS=<span style="color:#CC0000;">"YOURPASSWORD"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">RSYNCCOMAND=<span style="color:#CC0000;">"/usr/bin/rsync -qravm --force --delete-after $BACKUPPATH rsync://YOURREMOTESERVER/YOURREMOTEDIR/"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">CRYPTPASS=<span style="color:#CC0000;">"YOURCRYPTPASSWORD"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#########################################################</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">##############DO NOT CHANGE ANYTHING BELOW###############</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#########################################################</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">TODAY=$<span style="color:#006600; font-weight:bold;">&#40;</span>date +%s<span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">WORKDIR=$BACKUPPATH$TODAY<span style="color:#CC0000;">"/"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">DBLIST=$WORKDIR<span style="color:#CC0000;">"/backup.list"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">MD5FILE=$WORKDIR<span style="color:#CC0000;">"/backup.md5"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">TIMESTAMPFILE=$WORKDIR<span style="color:#CC0000;">"/backup.timestamp"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">if <span style="color:#006600; font-weight:bold;">&#91;</span> <span style="color:#CC0000;">"$1"</span> = <span style="color:#CC0000;">"-h"</span> <span style="color:#006600; font-weight:bold;">&#93;</span>;then</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; echo <span style="color:#CC0000;">"Uli's Backup Script V0.5"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; echo <span style="color:#CC0000;">"Copyright 2008 by Ulrich Wolf &lt;m [AT] il [DOT] wolf-u [DOT] li&gt;"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; echo <span style="color:#CC0000;">"Parameters:"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; echo <span style="color:#CC0000;">"-v Verbose Output with Parameter"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; echo <span style="color:#CC0000;">"-f Force Overwrite of Backupdirectory"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; exit <span style="color:#800000;color:#800000;">0</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">fi</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#########################################################</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo <span style="color:#CC0000;">"=================================================="</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo -n <span style="color:#CC0000;">"Anlegen des Backupverzeichnisses $TODAY"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">if <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#91;</span> -e $WORKDIR <span style="color:#006600; font-weight:bold;">&#93;</span> &amp;&amp; <span style="color:#006600; font-weight:bold;">&#91;</span> <span style="color:#CC0000;">"$1"</span> != <span style="color:#CC0000;">"-f"</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; then</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; echo <span style="color:#CC0000;">"...[fail]"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; if <span style="color:#006600; font-weight:bold;">&#91;</span> <span style="color:#CC0000;">"$1"</span> != <span style="color:#CC0000;">"-f"</span><span style="color:#006600; font-weight:bold;">&#93;</span>; then</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo <span style="color:#CC0000;">"Directory already exists. Quitting..."</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exit <span style="color:#800000;color:#800000;">1</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; fi</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">fi</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mkdir -p $WORKDIR</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo <span style="color:#CC0000;">"...[done]"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo <span style="color:#CC0000;">"Backup "</span>$<span style="color:#006600; font-weight:bold;">&#40;</span>date <span style="color:#CC0000;">'+%F %T'</span><span style="color:#006600; font-weight:bold;">&#41;</span>&gt; $TIMESTAMPFILE</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mysqlshow -u$MYSQLUSER -p$MYSQLPASS | awk <span style="color:#CC0000;">'{print $2}'</span> | sed -e <span style="color:#CC0000;">'/^[ ]*$/d'</span> | grep -v Databases | sort&gt;$DBLIST;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">DBANZAHL=$<span style="color:#006600; font-weight:bold;">&#40;</span>wc -l $DBLIST | cut -d<span style="color:#CC0000;">' '</span> -f <span style="color:#800000;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo <span style="color:#CC0000;">"MySQL-Datenbanken werden gesichert - Anzahl: $DBANZAHL"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo -n <span style="color:#CC0000;">"Backup running"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">if <span style="color:#006600; font-weight:bold;">&#91;</span> <span style="color:#CC0000;">"$1"</span> = <span style="color:#CC0000;">"-v"</span> <span style="color:#006600; font-weight:bold;">&#93;</span>;then</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; for <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#40;</span>i = <span style="color:#800000;color:#800000;">0</span>; i &lt;$DBANZAHL; i++<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; do</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo -n <span style="color:#CC0000;">'_'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; done;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; echo -n $<span style="color:#CC0000;">'_<span style="color:#000099; font-weight:bold;">\r</span>'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">fi</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">COUNT=<span style="color:#800000;color:#800000;">0</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">for x in `cat $DBLIST`; do</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; mysqldump --opt -u$MYSQLUSER -p$MYSQLPASS $x | gzip -c | /usr/bin/openssl aes-<span style="color:#800000;color:#800000;">256</span>-cbc -salt -pass pass:$CRYPTPASS&gt; $WORKDIR$x.<span style="">sql</span>.<span style="">gz</span>.<span style="">aes</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; let <span style="color:#CC0000;">"COUNT += 1"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; if <span style="color:#006600; font-weight:bold;">&#91;</span> <span style="color:#CC0000;">"$1"</span> = <span style="color:#CC0000;">"-v"</span> <span style="color:#006600; font-weight:bold;">&#93;</span>;then</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo -n <span style="color:#CC0000;">"#"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sleep <span style="color:#800000;color:#800000;">1</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; fi</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">done;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo <span style="color:#CC0000;">"...[done]"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo <span style="color:#CC0000;">"Backup: $COUNT/$DBANZAHL erfolgreich"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo -n <span style="color:#CC0000;">"MD5:"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">md5sum $WORKDIR*&gt;$MD5FILE;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo <span style="color:#CC0000;">"...[done]"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo <span style="color:#CC0000;">"=================================================="</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo <span style="color:#CC0000;">"Purging old Backups"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">VERZEICHNISSE=$<span style="color:#006600; font-weight:bold;">&#40;</span>ls -gGl $BACKUPPATH| grep ^d| tr -s <span style="color:#006600; font-weight:bold;">&#91;</span>:blank:<span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#CC0000;">" "</span> |cut -d<span style="color:#CC0000;">' '</span> -f <span style="color:#800000;color:#800000;">7</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">for dir in $VERZEICHNISSE</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">do</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; if <span style="color:#006600; font-weight:bold;">&#91;</span> $dir -lt $DELOLDERTHAN <span style="color:#006600; font-weight:bold;">&#93;</span>;then</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo <span style="color:#CC0000;">"Deleting "</span>$BACKUPPATH$dir;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rm -R $BACKUPPATH$dir;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; fi;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">done</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo <span style="color:#CC0000;">"MySQL-Backup abgeschlossen"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo <span style="color:#CC0000;">"=================================================="</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo -n <span style="color:#CC0000;">"Executing Rsync"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">RSYNC=$<span style="color:#006600; font-weight:bold;">&#40;</span>$RSYNCCOMAND<span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ER=$?;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">if <span style="color:#006600; font-weight:bold;">&#91;</span> $? = <span style="color:#800000;color:#800000;">0</span> <span style="color:#006600; font-weight:bold;">&#93;</span> ; then</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; echo <span style="color:#CC0000;">"...[done]"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">else</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; echo <span style="color:#CC0000;">"...[fail]"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; echo $RSYNC;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">fi</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo <span style="color:#CC0000;">"=================================================="</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Das Script beginnt mit diversen Configs:</p>
<ul>
<li>BACKUPPATH="/YOURDIR/";<br />
Zu &#196;ndern: Konfiguriert das lokale Backupverzeichnis</li>
<li>DELODERTHAN=$(date --date '-14 Days' +%s);<br />
F&#252;r versierte Nutzer: Anzahl der Tage, die ein Backup besteht, bitte nur die Zahl &#228;ndern, andere Werte auf eigene Gefahr.</li>
<li>MYSQLUSER="YOURLUSER";<br />
MySQL-Nutzer f&#252;r den Zugriff auf alle Datenbanken</li>
<li>MYSQLPASS="YOURPASSWORD";<br />
MySQL-Passwort f&#252;r den Nutzer mit Zugriff auf alle Datenbanken</li>
<li>RSYNCCOMAND="/usr/bin/rsync -qravm --force --delete-after $BACKUPPATH rsync://YOURREMOTESERVER/YOURREMOTEDIR/"<br />
Rsync-Zielserver</li>
<li>CRYPTPASS="YOURCRYPTPASSWORD";<br />
Verschl&#252;sselungspasswort im Klartext</li>
</ul>
<p>Sollte das Pruning fehlschlagen, so liegt es an der Zeile:</p>
<div class="igBar"><span id="lcode-47"><a href="#" onclick="javascript:showPlainTxt('code-47'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-47">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">VERZEICHNISSE=$<span style="color:#006600; font-weight:bold;">&#40;</span>ls -gGl $BACKUPPATH| grep ^d| tr -s <span style="color:#006600; font-weight:bold;">&#91;</span>:blank:<span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#CC0000;">" "</span> |cut -d<span style="color:#CC0000;">' '</span> -f <span style="color:#800000;color:#800000;">7</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Evtl muss hinten die Zahl ver&#228;ndert werden. Das Pruning arbeitet bei mir relativ einfach: es werden alle Verzeichnisse untereinander aufgelistet und anschlie&#223;end wird jede gepr&#252;ft, ob es veraltet ist. Wenn ja, dann wird es gel&#246;scht und eine entsprechende Meldung ausgegeben.</p>
<p>Nat&#252;rlich kann man das Script bestens im Cron laufen lassen, ich bekommen t&#228;glich zwei Mails dazu und gut is <img src='http://wolf-u.li/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Restore geht ganz einfach:<br />
Die Dateien sind ja nun als *.sql.gz.aes abgelegt. F&#252;r den Restore ben&#246;tigt man nun das Plaintext-SQL-File, welches mit folgendem Befehl zu bekommen ist:</p>
<div class="igBar"><span id="lcode-48"><a href="#" onclick="javascript:showPlainTxt('code-48'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-48">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">openopenssl enc -d -aes-<span style="color:#800000;color:#800000;">256</span>-cbc -in INPUTFILE -pass pass:YOURCRYPTPASSWORD|gunzip&gt; OUTPUTFILE </div>
</li>
</ol>
</div>
</div>
</div>
<p>
Wobei YOURCRYPTPASSWORD durch das oben gesetzte Passwort zu ersetzen ist. INPUTFILE ist das gesicherte Archiv mit der Datenbank und OUTPUTFILE ist das Plaintext-SQL-File.</p>
<p>Bei Fragen einfach melden <img src='http://wolf-u.li/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<hr /><small><center>&copy; 2005-2009 by <a href='http://wolf-u.li/'>Uli Wolf</a> - This Content is distributed under the <a href='http://wolf-u.li/pwnd-faq/'>Creative Commons License</a><br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites without attribution to the author and notification of the author breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. (Digital Fingerprint:  d2a576b5311479d89eff39b7ca886f6b)</center></small>]]></content:encoded>
			<wfw:commentRss>http://wolf-u.li/1291/einfaches-mysql-backup-mit-pruning-und-verschluesselung-mittels-bash-rsync/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Eine kleine MySQL-Klasse f&#252;r PHP</title>
		<link>http://wolf-u.li/787/eine-kleine-mysql-klasse-fuer-php/</link>
		<comments>http://wolf-u.li/787/eine-kleine-mysql-klasse-fuer-php/#comments</comments>
		<pubDate>Fri, 07 Dec 2007 22:53:11 +0000</pubDate>
		<dc:creator>Uli</dc:creator>
				<category><![CDATA[Infotech]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://wolf-u.li/787/eine-kleine-mysql-klasse-fuer-php/</guid>
		<description><![CDATA[Ich habe mir eine kleine MySQL-Klasse f&#252;r PHP gebastelt, die mittlerweile schon von einigen Kumpels f&#252;r ihre eigenen Projekte kopiert wurde. Die Klasse besteht aus einer Config-Datei und der Datenbankklasse selbst. Ich bin mir sicher, dass man einige Dinge besser machen k&#246;nnte, diese Klasse ist aber f&#252;r viele Anwendungsbereich vollkommen ausreichend. Verbesserungsvorschl&#228;ge sind willkommen!

Hier zun&#228;chst [...]]]></description>
			<content:encoded><![CDATA[<p>Ich habe mir eine kleine MySQL-Klasse f&#252;r PHP gebastelt, die mittlerweile schon von einigen Kumpels f&#252;r ihre eigenen Projekte kopiert wurde. Die Klasse besteht aus einer Config-Datei und der Datenbankklasse selbst. Ich bin mir sicher, dass man einige Dinge besser machen k&#246;nnte, diese Klasse ist aber f&#252;r viele Anwendungsbereich vollkommen ausreichend. Verbesserungsvorschl&#228;ge sind willkommen!<br />
<span id="more-787"></span></p>
<p>Hier zun&#228;chst der Download der beiden untenstehenden Dateien in einem Zip-Archiv: <a href='http://wolf-u.li/upload/2007/12/wolf-uli-database-class.zip' title='wolf-uli-database-class.zip'>wolf-uli-database-class.zip</a></p>
<p><a href="javascript:void(null);" onclick="s_toggleDisplay(document.getElementById('SID784809338'), this, 'Show &#9660;', 'Hide &#9650;');">Show &#9660;</a></p>
<div id='SID784809338' style='display:none;'>
<div class="igBar"><span id="lphp-51"><a href="#" onclick="javascript:showPlainTxt('php-51'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-51">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">&lt;?</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/*************************************************************\</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">| This Database class was created by:&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">|&nbsp; &nbsp; &nbsp;Ulrich Wolf&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">|&nbsp; &nbsp; &nbsp;m [at] il [dot] wolf-u [dot] li&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">| This Class is distributed under the&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">|&nbsp; &nbsp; &nbsp; Creative Commons Licence 2.0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Attribution Noncommercial Share Alike 2.0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">| You are free to Share and to adapt my work &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">| You may not use this work for commercial purposes (ask me)&nbsp; |</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">| You have to attribute my work with my Name &amp; E-Mail&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">| Exceptions to these terms only on enquiry (Mail me!)&nbsp; &nbsp; &nbsp; &nbsp; |</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">| URL:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">| http://creativecommons.org/licenses/by-nc-sa/2.0/de/deed.en |</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">\*************************************************************/</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"> * @file</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"> * @brief Database Abstraction Class</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"> */</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">class</span> DB <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #ff0000">$connection</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #ff0000">$resultid</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #ff0000">$querystring</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #808080; font-style: italic;">/**</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; * Constructor</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; * @access public</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; */</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">function</span> DB<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/global"><span style="color: #000066;">global</span></a> <span style="color: #ff0000">$config</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$config</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'db'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'autoconnect'</span><span style="color: #66cc66;">&#93;</span> == <span style="color: #000000; font-weight: bold;">TRUE</span><span style="color: #66cc66;">&#41;</span> <span style="color: #ff0000">$this</span>-&gt;<span style="color: #006600;">connect</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #808080; font-style: italic;">/**</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; * Establishes the Connection to the Database</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; *</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; * @return NULL</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; * @access public</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; * @param&nbsp; boolean</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; */</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">function</span> connect<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/global"><span style="color: #000066;">global</span></a> <span style="color: #ff0000">$config</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$config</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'db'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'persistent'</span><span style="color: #66cc66;">&#93;</span> == <span style="color: #000000; font-weight: bold;">FALSE</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #ff0000">$this</span>-&gt;<span style="color: #006600;">connection</span> = @<a href="http://www.php.net/mysql_connect"><span style="color: #000066;">mysql_connect</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$config</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'db'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'host'</span><span style="color: #66cc66;">&#93;</span>, <span style="color: #ff0000">$config</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'db'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'user'</span><span style="color: #66cc66;">&#93;</span>, <span style="color: #ff0000">$config</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'db'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'pass'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; or <a href="http://www.php.net/die"><span style="color: #000066;">die</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"{connect} Database Error:"</span>.<a href="http://www.php.net/mysql_errno"><span style="color: #000066;">mysql_errno</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #ff0000;">" : "</span>.<a href="http://www.php.net/mysql_error"><span style="color: #000066;">mysql_error</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #ff0000">$this</span>-&gt;<span style="color: #006600;">connection</span> = @<a href="http://www.php.net/mysql_pconnect"><span style="color: #000066;">mysql_pconnect</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$config</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'db'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'host'</span><span style="color: #66cc66;">&#93;</span>, <span style="color: #ff0000">$config</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'db'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'user'</span><span style="color: #66cc66;">&#93;</span>, <span style="color: #ff0000">$config</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'db'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'pass'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; or <a href="http://www.php.net/die"><span style="color: #000066;">die</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"{connect} Database Error: "</span>.<a href="http://www.php.net/mysql_errno"><span style="color: #000066;">mysql_errno</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #ff0000;">" : "</span>.<a href="http://www.php.net/mysql_error"><span style="color: #000066;">mysql_error</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; @<a href="http://www.php.net/mysql_select_db"><span style="color: #000066;">mysql_select_db</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$config</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'db'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'database'</span><span style="color: #66cc66;">&#93;</span>, <span style="color: #ff0000">$this</span>-&gt;<span style="color: #006600;">connection</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; or <a href="http://www.php.net/die"><span style="color: #000066;">die</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"{select_db} Database Error: "</span>.<a href="http://www.php.net/mysql_errno"><span style="color: #000066;">mysql_errno</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #ff0000;">" : "</span>.<a href="http://www.php.net/mysql_error"><span style="color: #000066;">mysql_error</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #808080; font-style: italic;">/**</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; * Queries the database and returns the Result-ID</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; *</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; * @return string</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; * @access public</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; * @param&nbsp; string</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; */</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">function</span> query<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$querystring</span>, <span style="color: #ff0000">$quiet</span>=<span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$quiet</span> == <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #ff0000">$this</span>-&gt;<span style="color: #006600;">resultid</span> = <a href="http://www.php.net/mysql_query"><span style="color: #000066;">mysql_query</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$querystring</span>, <span style="color: #ff0000">$this</span>-&gt;<span style="color: #006600;">connection</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000">$this</span>-&gt;<span style="color: #006600;">resultid</span> = <a href="http://www.php.net/mysql_query"><span style="color: #000066;">mysql_query</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$querystring</span>, <span style="color: #ff0000">$this</span>-&gt;<span style="color: #006600;">connection</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; or <a href="http://www.php.net/die"><span style="color: #000066;">die</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"&lt;pre&gt;{DB-&gt;query} Database Error : "</span>.<a href="http://www.php.net/mysql_errno"><span style="color: #000066;">mysql_errno</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #ff0000;">" : "</span>.<a href="http://www.php.net/mysql_error"><span style="color: #000066;">mysql_error</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> . <span style="color: #ff0000;">"&lt;br /&gt;Query: "</span> . <span style="color: #ff0000">$querystring</span> . <span style="color: #ff0000;">"&lt;/pre&gt;"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #ff0000">$this</span>-&gt;<span style="color: #006600;">resultid</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #808080; font-style: italic;">/**</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; * Fetch Array on a given Queryresultid or the default id</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; *</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; * @return array An Array with the Results from the Query-ID</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; * @access public</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; * @param int query_id Specific Query-ID</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; */</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">function</span> fetch_array<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$query_id</span> = <span style="color: #ff0000;">""</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$query_id</span> == <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <a href="http://www.php.net/mysql_fetch_array"><span style="color: #000066;">mysql_fetch_array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$this</span>-&gt;<span style="color: #006600;">resultid</span>, MYSQL_ASSOC<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <a href="http://www.php.net/mysql_fetch_array"><span style="color: #000066;">mysql_fetch_array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$query_id</span>, MYSQL_ASSOC<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #808080; font-style: italic;">/**</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; * Gets the ID of the last inserted Row</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; *</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; * @return INT ID of the Row</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; * @access public</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; */</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">function</span> getLastInsertedId<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <a href="http://www.php.net/mysql_insert_id"><span style="color: #000066;">mysql_insert_id</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$this</span>-&gt;<span style="color: #006600;">connection</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #808080; font-style: italic;">/**</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; * Gets the number of rows of the last query</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; *</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; * @return Number of rows</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; * @access public</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; */</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">function</span> getNumRows<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <a href="http://www.php.net/mysql_num_rows"><span style="color: #000066;">mysql_num_rows</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$this</span>-&gt;<span style="color: #006600;">resultid</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #808080; font-style: italic;">/**</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; * Closes the Connection to the Database</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; *</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; * @access public</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; */</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">function</span> close<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<a href="http://www.php.net/mysql_close"><span style="color: #000066;">mysql_close</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$this</span>-&gt;<span style="color: #006600;">connection</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;or <a href="http://www.php.net/die"><span style="color: #000066;">die</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"{close} Database Error: "</span>.<a href="http://www.php.net/mysql_errno"><span style="color: #000066;">mysql_errno</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #ff0000;">" : "</span>.<a href="http://www.php.net/mysql_error"><span style="color: #000066;">mysql_error</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
</div>
<p>Wie kann man also nun die Klasse verwenden? Zun&#228;chst braucht man entweder das Zip-Archiv oder man nimmt die vorstehende Datenbankklasse, welche man als <code>db.php</code> im Webserververzeichnis ablegt. Nun legt man im gleichen Verzeichnis eine beliebige PHP-Datei an, welche mit dem folgenden Inhalt gef&#252;llt wird:<br />
<a href="javascript:void(null);" onclick="s_toggleDisplay(document.getElementById('SID27004159'), this, 'Show &#9660;', 'Hide &#9650;');">Show &#9660;</a></p>
<div id='SID27004159' style='display:none;'>
<div class="igBar"><span id="lphp-52"><a href="#" onclick="javascript:showPlainTxt('php-52'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-52">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">&lt;?</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/*************************************************************\</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">| This Database class was created by:&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">|&nbsp; &nbsp; &nbsp;Ulrich Wolf&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">|&nbsp; &nbsp; &nbsp;m [at] il [dot] wolf-u [dot] li&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">| This Class is distributed under the&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">|&nbsp; &nbsp; &nbsp; Creative Commons Licence 2.0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Attribution Noncommercial Share Alike 2.0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">| You are free to Share and to adapt my work &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">| You may not use this work for commercial purposes (ask me)&nbsp; |</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">| You have to attribute my work with my Name &amp; E-Mail&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">| Exceptions to these terms only on enquiry (Mail me!)&nbsp; &nbsp; &nbsp; &nbsp; |</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">| URL:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">| http://creativecommons.org/licenses/by-nc-sa/2.0/de/deed.en |</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">\*************************************************************/</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Database-Settings:</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000">$config</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'db'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'host'</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;= <span style="color: #ff0000;">'localhost'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000">$config</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'db'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'user'</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;= <span style="color: #ff0000;">'username'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000">$config</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'db'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'pass'</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;= <span style="color: #ff0000;">'userpassword'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000">$config</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'db'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'database'</span><span style="color: #66cc66;">&#93;</span>&nbsp; &nbsp;&nbsp; &nbsp;= <span style="color: #ff0000;">'databasename'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000">$config</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'db'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'persistent'</span><span style="color: #66cc66;">&#93;</span>&nbsp;= <span style="color: #000000; font-weight: bold;">FALSE</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000">$config</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'db'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'autoconnect'</span><span style="color: #66cc66;">&#93;</span>= <span style="color: #000000; font-weight: bold;">FALSE</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">include</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"db.php"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//Establish the Connection to the Database</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000">$DB</span> = <span style="color: #000000; font-weight: bold;">new</span> DB;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000">$DB</span>-&gt;<span style="color: #006600;">connect</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000">$DB</span>-&gt;<span style="color: #006600;">query</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"DATENBANKABFRAGE"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">while</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$row</span> = <span style="color: #ff0000">$DB</span>-&gt;<span style="color: #006600;">fetch_array</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000">$results</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #ff0000">$row</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000">$DB</span>-&gt;<span style="color: #006600;">close</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
</div>
<p>Wie man sieht, wird zun&#228;chst eine Verbindung mit der Datenbank aufgebaut, anschlie&#223;end wird ein Query abgesetzt und dieser verarbeitet. Zuletzt wird die Verbindung geschlossen.</p>
<p>Bei Fragen einfach melden. Ich &#252;bernehme keine Verantwortung f&#252;r entstehende Sch&#228;den und Datenverluste <img src='http://wolf-u.li/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' />  Diese Klasse wurde nach bestem Wissen und Gewissen geschrieben.</p>
<hr /><small><center>&copy; 2005-2009 by <a href='http://wolf-u.li/'>Uli Wolf</a> - This Content is distributed under the <a href='http://wolf-u.li/pwnd-faq/'>Creative Commons License</a><br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites without attribution to the author and notification of the author breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. (Digital Fingerprint:  d2a576b5311479d89eff39b7ca886f6b)</center></small>]]></content:encoded>
			<wfw:commentRss>http://wolf-u.li/787/eine-kleine-mysql-klasse-fuer-php/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>MySQL-Tuning per my.cnf und Analyse-Skript</title>
		<link>http://wolf-u.li/728/mysql-tuning-per-mycnf-und-analyse-skript/</link>
		<comments>http://wolf-u.li/728/mysql-tuning-per-mycnf-und-analyse-skript/#comments</comments>
		<pubDate>Fri, 03 Aug 2007 11:37:13 +0000</pubDate>
		<dc:creator>Uli</dc:creator>
				<category><![CDATA[Infotech]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://wolf-u.li/728/mysql-tuning-per-mycnf-und-analyse-skript/</guid>
		<description><![CDATA[Heute morgen hats mich erwischt...der MySQL5-Server hatte ein kleines Problem...
Aufgrund der gestiegenen Last auf dem neuen Server hat die Anzahl der Queries die Anzahl der max_connections erreicht. Was heisst das konkret? Queries, welche nach dem &#220;berschreiten dieser Zahl gesetzt werden, werden nicht ausgef&#252;hrt, sondern mit dem Fehler "Too many Connections (localhost)" abgewiesen.

Wie kann man nun [...]]]></description>
			<content:encoded><![CDATA[<p><a href='http://wolf-u.li/upload/2007/08/728-mysql-tuning-nach-toomany-connections.jpg' title='MySQL Fehlermeldung Too many connections' rel='lightbox'><img align="left" src='http://wolf-u.li/upload/2007/08/728-mysql-tuning-nach-toomany-connections.thumbnail.jpg' alt='276-mysql-tuning-nach-toomany-connections.jpg' /></a>Heute morgen hats mich erwischt...der MySQL5-Server hatte ein kleines Problem...<br />
Aufgrund der gestiegenen Last auf dem neuen Server hat die Anzahl der Queries die Anzahl der max_connections erreicht. Was heisst das konkret? Queries, welche nach dem &#220;berschreiten dieser Zahl gesetzt werden, werden nicht ausgef&#252;hrt, sondern mit dem Fehler "Too many Connections (localhost)" abgewiesen.<br />
<span id="more-728"></span><br />
Wie kann man nun den MySQL-Server ein wenig tunen?</p>
<p>Es gibt hierzu ein Skript von <a href="http://www.day32.com/MySQL/">Day32</a>, welches bei mir hervorragende Dienste geleistet hat:</p>
<div class="igBar"><span id="lcode-57"><a href="#" onclick="javascript:showPlainTxt('code-57'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-57">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">cd /usr/src/</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">wget http:<span style="color:#FF9933; font-style:italic;">//www.day32.com/MySQL/tuning-primer.sh</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sh tuning-primer.<span style="">sh</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Tuning primer gibt nun eine Menge Vorschl&#228;ge und Ratschl&#228;ge aus, um den MySQL-Server ein bisschen zu tunen. Bei mir wars vor allem die Variable max_connections, welche per Default auf 100 steht, die nun ein wenig zu niedrig war.</p>
<p>Um dies zu &#228;ndern &#246;ffnet man die Datei <em>my.cnf</em> (bei mir unter <em>/etc/mysql/</em>) und f&#252;gt in der Sektion [mysqld] folgenden Wert hinzu (Bitte Anzahl der gleichzeitigen Verbindungen selbst w&#228;hlen, ich habe mal 500 eingetragen):</p>
<div class="igBar"><span id="lcode-58"><a href="#" onclick="javascript:showPlainTxt('code-58'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-58">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">max_connections&nbsp; &nbsp; &nbsp; &nbsp;= <span style="color:#800000;color:#800000;">250</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
<small>Achtung: Bei mir trat ein Fehler auf, wenn ich vor und nach dem '=' keine Leerzeichen gesetzt hatte. Ausserdem wird f&#252;r jede Connection Ram ben&#246;tigt, tuning-primer meckert aber dann schon <img src='http://wolf-u.li/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </small></p>
<p>Nun kann man entweder den Server neu starten, oder man setzt es tempor&#228;r bis zum Neustart mit einem Query in die Datenbank:</p>
<div class="igBar"><span id="lcode-59"><a href="#" onclick="javascript:showPlainTxt('code-59'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-59">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mysql -u root -p</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mysql&gt; set GLOBAL max_connections=<span style="color:#800000;color:#800000;">250</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mysql&gt; exit; </div>
</li>
</ol>
</div>
</div>
</div>
<p>
Man kann das schnell pr&#252;fen, in dem man vor dem <em>exit;</em> folgenden Befehl in die Datenbank absetzt:</p>
<div class="igBar"><span id="lcode-60"><a href="#" onclick="javascript:showPlainTxt('code-60'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-60">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">show variables like <span style="color:#CC0000;">'max_connections'</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Weitergehende Informationen bekommt man beim <a href="http://dev.mysql.com/doc/mysql/en/Too_many_connections.html ">Hersteller</a> im Handbuch.</p>
<p>Danke an dieser Stelle an <a href="http://blog.alexarnold.de/">Alex</a> (dem ich den Fehler nicht glauben wollte) und <a href="http://science.geopfert.de/">PaGo</a> (f&#252;r den Screenshot, ich hab da noch geschlafen <img src='http://wolf-u.li/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  )</p>
<hr /><small><center>&copy; 2005-2009 by <a href='http://wolf-u.li/'>Uli Wolf</a> - This Content is distributed under the <a href='http://wolf-u.li/pwnd-faq/'>Creative Commons License</a><br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites without attribution to the author and notification of the author breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. (Digital Fingerprint:  d2a576b5311479d89eff39b7ca886f6b)</center></small>]]></content:encoded>
			<wfw:commentRss>http://wolf-u.li/728/mysql-tuning-per-mycnf-und-analyse-skript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
