<?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>PHP Log &#187; Administration</title>
	<atom:link href="http://www.php-log.de/tags/administration/feed" rel="self" type="application/rss+xml" />
	<link>http://www.php-log.de</link>
	<description>Eine feine Sammlung nützlicher PHP Notizen</description>
	<lastBuildDate>Mon, 20 Sep 2010 00:22:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Nützliche Linux Shell Kommandos</title>
		<link>http://www.php-log.de/242/php/nutzliche-linux-shell-kommandos</link>
		<comments>http://www.php-log.de/242/php/nutzliche-linux-shell-kommandos#comments</comments>
		<pubDate>Thu, 09 Apr 2009 11:11:02 +0000</pubDate>
		<dc:creator>ralle</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://www.php-log.de/?p=242</guid>
		<description><![CDATA[Hier werde ich mit der Zeit die Shell Kommandos auflisten die ich im Laufe der Zeit so benötige. # Anzahl der Dateien in einem Ordner ermitteln ls -l ordnername &#124; wc -l &#160; # Anzahl der Dateien in einem Ordner und Unterordnern ermitteln ls -lR ordnername &#124; wc -l # Wieviel Platz ist noch auf [...]]]></description>
			<content:encoded><![CDATA[<p>Hier werde ich mit der Zeit die Shell Kommandos auflisten die ich im Laufe der Zeit so benötige.<span id="more-242"></span></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Anzahl der Dateien in einem Ordner ermitteln</span>
<span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-l</span> ordnername <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">wc</span> <span style="color: #660033;">-l</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Anzahl der Dateien in einem Ordner und Unterordnern ermitteln</span>
<span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-lR</span> ordnername <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">wc</span> <span style="color: #660033;">-l</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Wieviel Platz ist noch auf der Festplatte?</span>
<span style="color: #c20cb9; font-weight: bold;">df</span> <span style="color: #660033;">-h</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Wie groß ist ein bestimmtes Verzeichnis?</span>
<span style="color: #c20cb9; font-weight: bold;">du</span> <span style="color: #660033;">-c</span> <span style="color: #660033;">-h</span> ordnername<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tail</span> <span style="color: #660033;">-1</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># In welchen Dateien steht Suchphrase? (Achtung rekursiv ab dem aktuellen Verzeichnis)</span>
<span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-R</span> <span style="color: #660033;">-H</span> <span style="color: #ff0000;">&quot;Suche Phrase&quot;</span> .</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Wieivel Zeilen hat eine Datei</span>
<span style="color: #c20cb9; font-weight: bold;">wc</span> <span style="color: #660033;">-l</span> datei.txt</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Alle .svn Verzeichnisse löschen</span>
<span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;.svn&quot;</span> <span style="color: #660033;">-exec</span> <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-rf</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Zeilen in einer Datei löschen</span>
<span style="color: #666666; font-style: italic;"># Hilfreich wenn man z.B. Create Database Statements aus einem MySQL dump löschen möchte</span>
<span style="color: #666666; font-style: italic;"># Hier werden die Zeilen 20 - 25 gelöscht</span>
<span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'20,25d'</span> current.sql <span style="color: #000000; font-weight: bold;">&amp;</span>gt; cleaned.sql</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.php-log.de/242/php/nutzliche-linux-shell-kommandos/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mod_Rewrite über eine Datei</title>
		<link>http://www.php-log.de/165/allgemeines/mod_rewrite-uber-eine-datei</link>
		<comments>http://www.php-log.de/165/allgemeines/mod_rewrite-uber-eine-datei#comments</comments>
		<pubDate>Wed, 11 Feb 2009 04:24:46 +0000</pubDate>
		<dc:creator>ralle</dc:creator>
				<category><![CDATA[Allgemeines]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[mod_rewrite]]></category>

		<guid isPermaLink="false">http://www.php-log.de/?p=165</guid>
		<description><![CDATA[Eigentlich jedes Framework dass das MVC Konzept abbildet, schickt jeden Request der am Webserver aufschlägt über eine zentrale Datei. Meist ist das die index.php die sich im Webroot befindet. Dies wird mit Hilfe des (gefürchteten) Apache Moduls &#8220;Mod Rewrite&#8221; realisiert und da &#8220;Mod Rewrite&#8221; lediglich ein Regelwerk vorgibt, und es dazu noch Reguläre Ausdrücke unterstützt, [...]]]></description>
			<content:encoded><![CDATA[<p>Eigentlich jedes Framework dass das MVC Konzept abbildet, schickt jeden Request der am Webserver aufschlägt über eine zentrale Datei. Meist ist das die index.php die sich im Webroot befindet. Dies wird mit Hilfe des (gefürchteten) Apache Moduls &#8220;Mod Rewrite&#8221; realisiert und da &#8220;Mod Rewrite&#8221; lediglich ein Regelwerk vorgibt, und es dazu noch Reguläre Ausdrücke unterstützt, gibt es gibt verschiedene Ansätze wie das erreicht werden kann. Ich möchte hier den Ansatz zeigen der meiner Meinung nach der flexibelste ist.<span id="more-165"></span></p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;">    <span style="color: #00007f;">RewriteEngine</span> <span style="color: #0000ff;">On</span>
    <span style="color: #00007f;">RewriteCond</span> %{REQUEST_FILENAME} !-d
    <span style="color: #00007f;">RewriteCond</span> %{REQUEST_FILENAME} !-f
    <span style="color: #00007f;">RewriteRule</span> ^(.*)$ index.php?url=$1 [QSA,L]</pre></div></div>

<p>Die Regel <strong>RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]</strong> besagt: &#8220;Schicke einfach jeden Request auf die index.php&#8221;. Die erste Rewrite Condition <strong>RewriteCond %{REQUEST_FILENAME} !-d</strong> aber sagt: &#8220;Gilt aber nicht wenn das Verzeichnis tatsächlich existiert&#8221;. Die zweite Rewrite Condition <strong>RewriteCond %{REQUEST_FILENAME} !-f</strong> fügt noch hinzu: &#8220;Und auch nicht wenn die Datei tatsächlich existiert&#8221;. Somit werden also alle &#8220;virtuellen&#8221; Requests auf die index.php geleitet, aber vorhandene Resourcen wie Bilder, CSS, JavaScript-Dateien etc. werden nicht über das Framework geschickt.</p>
<blockquote><p>Andere Ansätze funktionieren natürlich auch, aber bei diesem Ansatz ist es sehr einfach externe Scripte, die nicht zum Framework gehören, einzubinden. Im besten Fall legt man Sie einfach im Webroot ab.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.php-log.de/165/allgemeines/mod_rewrite-uber-eine-datei/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ein neues CakePHP Projekt anlegen</title>
		<link>http://www.php-log.de/86/php/ein-neues-cakephp-projekt-anlegen</link>
		<comments>http://www.php-log.de/86/php/ein-neues-cakephp-projekt-anlegen#comments</comments>
		<pubDate>Sun, 01 Feb 2009 13:01:21 +0000</pubDate>
		<dc:creator>ralle</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Administration]]></category>

		<guid isPermaLink="false">http://www.php-log.de/?p=86</guid>
		<description><![CDATA[CakePHP ist für mich derzeit das Framework der Wahl. Nicht zuletzt wegen der Nähe zu Ruby On Rails, der Mutter moderner MVC Frameworks. Das Anlegen eines neuen Projekt mit CakePHP ist relativ einfach, aber ein kleiner Leitfaden kann ja nie schaden. Bevor es losgeht sollte die Umgebung eingerichtet werden, dazu gehört das Anlegen eines VirtualHost [...]]]></description>
			<content:encoded><![CDATA[<p>CakePHP ist für mich derzeit das Framework der Wahl. Nicht zuletzt wegen der Nähe zu Ruby On Rails, der Mutter moderner MVC Frameworks. Das Anlegen eines neuen Projekt mit CakePHP ist relativ einfach, aber ein kleiner Leitfaden kann ja nie schaden. Bevor es losgeht sollte die Umgebung eingerichtet werden, dazu gehört das Anlegen eines VirtualHost im Apache, der entsprechende Eintrag in der hosts Datei, so es denn um die Einrichtung auf dem lokalem Rechner geht und das Anlegen einer Datenbank.</p>
<p><span id="more-86"></span>Im Apache Config file sollte dann sowas stehen:</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;">    <span style="color: #00007f;">DocumentRoot</span> <span style="color: #7f007f;">&quot;/www/projektname/app/webroot&quot;</span>
    <span style="color: #00007f;">ServerName</span> projektname.localhost</pre></div></div>

<p>Die Datei /etc/hosts bekommt Ihren Eintrag (unter Windows findest sich die Datei in c\windows\system32\drivers oder so):</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">127.0.0.1       projektname.localhost</pre></div></div>

<p>Die Datenbank und der User werden angelegt. Eine Anleitung dazu findet sich <a href="http://www.php-log.de/?p=61" target="_blank">hier</a></p>
<p>Nun ist es ein guter Zeitpunkt den Apache neu zu starten.</p>
<p>Dann navigiert man auf der Kommandozeile in den Ordner, der einmal das neue Projekt beherbergen soll. Ich sammel meine Projekte im Ordner &#8220;/www&#8221;</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">cd /www
svn export https://svn.cakephp.org/repo/branches/1.2.x.x/ projektname</pre></div></div>

<p>Wichtig ist halt dass man mit &#8220;Export&#8221; die Daten lädt und nicht mit &#8220;checkout&#8221;, das Projekt soll ja in ein eigenes SVN Repository.</p>
<p>Jetzt den Browser öffnen, die URL ist projektname.localhost und dann den Anweisungen folgen. Schreibrechte setzten, Datenbank Parameter und was CakePHP sonst fordert.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.php-log.de/86/php/ein-neues-cakephp-projekt-anlegen/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PureFTPD</title>
		<link>http://www.php-log.de/75/php/pureftpd</link>
		<comments>http://www.php-log.de/75/php/pureftpd#comments</comments>
		<pubDate>Sat, 31 Jan 2009 17:40:08 +0000</pubDate>
		<dc:creator>ralle</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Administration]]></category>

		<guid isPermaLink="false">http://www.php-log.de/?p=75</guid>
		<description><![CDATA[PureFTPD ist ein FTP Server der mächtig und vor allem flexibel ist. Er ermöglicht unter anderem die Authentifikation über eine MySQL Tabelle. Dass macht ihn besonders attraktiv, insbesondere für Portale wie Video-Communities, wo große Datenmengen durch die Drähte geschickt werden müssen. Auf einem Ubuntu Rechner ist auch die Installation relativ Schmerzfrei. Eine gute Anleitung gibt [...]]]></description>
			<content:encoded><![CDATA[<p>PureFTPD ist ein FTP Server der mächtig und vor allem flexibel ist. Er ermöglicht unter anderem die Authentifikation über eine MySQL Tabelle. Dass macht ihn besonders attraktiv, insbesondere für Portale wie Video-Communities, wo große Datenmengen durch die Drähte geschickt werden müssen.</p>
<p><span id="more-75"></span>Auf einem Ubuntu Rechner ist auch die Installation relativ Schmerzfrei. Eine gute Anleitung gibt es hier:</p>
<p><a href="http://www.howtoforge.com/virtual-hosting-with-pureftpd-and-mysql-ubuntu-7.10" target="_blank">http://www.howtoforge.com/virtual-hosting-with-pureftpd-and-mysql-ubuntu-7.10</a></p>
<p>Eine Fehlerquelle kann sein dass die Queries ein Escapen erforden und das kann bei Copy &amp; Paste schon mal verloren gehen:</p>
<p>Richtig:</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">MYSQLGetPW      SELECT Password FROM ftpd WHERE User=&quot;\L&quot; AND status=&quot;1&quot; AND (ipaccess = &quot;*&quot; OR ipaccess LIKE &quot;\R&quot;)</pre></div></div>

<p>Bunter Nachmittag wegen fehlendem Backslash:</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">MYSQLGetPW      SELECT Password FROM ftpd WHERE User=&quot;L&quot; AND status=&quot;1&quot; AND (ipaccess = &quot;*&quot; OR ipaccess LIKE &quot;R&quot;)</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.php-log.de/75/php/pureftpd/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL User und Datenbank in einem Rutsch über die Kommandozeile</title>
		<link>http://www.php-log.de/61/mysql/mysql-user-und-datenbank-in-einem-rutsch-uber-die-kommandozeile</link>
		<comments>http://www.php-log.de/61/mysql/mysql-user-und-datenbank-in-einem-rutsch-uber-die-kommandozeile#comments</comments>
		<pubDate>Fri, 30 Jan 2009 15:11:27 +0000</pubDate>
		<dc:creator>ralle</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Administration]]></category>

		<guid isPermaLink="false">http://www.php-log.de/?p=61</guid>
		<description><![CDATA[Gerade wenn man neu auf einem Server ist, kann es passieren das man mal eben schnell eine Datenbank und einen dazu gehörenden User braucht. Dieses kurze SQL File legt einen neuen User und eine neue Datenbank an und weist dem User alle Rechte an besagter neuen Datenbank zu. # file: install.sql FLUSH PRIVILEGES ; CREATE [...]]]></description>
			<content:encoded><![CDATA[<p>Gerade wenn man neu auf einem Server ist, kann es passieren das man mal eben schnell eine Datenbank und einen dazu gehörenden User braucht. Dieses kurze SQL File legt einen neuen User und eine neue Datenbank an und weist dem User alle Rechte an besagter neuen Datenbank zu.</p>
<p><span id="more-61"></span></p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># file: install.sql</span>
FLUSH <span style="color: #990099; font-weight: bold;">PRIVILEGES</span> <span style="color: #000033;">;</span>
<span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #000099;">USER</span> <span style="color: #008000;">'userxy'</span>@<span style="color: #008000;">'localhost'</span> IDENTIFIED BY <span style="color: #008000;">'passwordxy'</span><span style="color: #000033;">;</span>
<span style="color: #990099; font-weight: bold;">GRANT</span> <span style="color: #990099; font-weight: bold;">USAGE</span> <span style="color: #990099; font-weight: bold;">ON</span> <span style="color: #CC0099;">*</span> . <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">TO</span> <span style="color: #008000;">'userxy'</span>@<span style="color: #008000;">'localhost'</span> IDENTIFIED BY <span style="color: #008000;">'passwordxy'</span> <span style="color: #990099; font-weight: bold;">WITH</span> MAX_QUERIES_PER_HOUR <span style="color: #008080;">0</span> MAX_CONNECTIONS_PER_HOUR <span style="color: #008080;">0</span> MAX_UPDATES_PER_HOUR <span style="color: #008080;">0</span> MAX_USER_CONNECTIONS <span style="color: #008080;">0</span> <span style="color: #000033;">;</span>
<span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #990099; font-weight: bold;">DATABASE</span> <span style="color: #990099; font-weight: bold;">IF <span style="color: #CC0099; font-weight: bold;">NOT</span> EXISTS</span> <span style="color: #008000;">`datenbankxy`</span> <span style="color: #000033;">;</span>
<span style="color: #990099; font-weight: bold;">GRANT</span> <span style="color: #990099; font-weight: bold;">ALL</span> <span style="color: #990099; font-weight: bold;">PRIVILEGES</span> <span style="color: #990099; font-weight: bold;">ON</span> <span style="color: #008000;">`datenbankxy`</span> . <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">TO</span> <span style="color: #008000;">'userxy'</span>@<span style="color: #008000;">'localhost'</span><span style="color: #000033;">;</span>
FLUSH <span style="color: #990099; font-weight: bold;">PRIVILEGES</span> <span style="color: #000033;">;</span></pre></div></div>

<p>Auf der Shell kann dann mit</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">mysql &lt; install.sql</pre></div></div>

<p>die Datenbank inkl. User installiert werden.</p>
<p>Achso&#8230;damit der Aufruf von mysql ohne Verbindungsparameter klappt, hinterlegt man einfach eine .my.cnf Datei im Home Folder des SSH Users. Diese Datei hat einfach folgenden Inhalt:</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">[client]
user=ssh-username
password=strengestensgeheimundanonymisiert
&nbsp;
[mysqld]
default-character-set=utf8
default-collation=latin1_german1_ci</pre></div></div>

<p># file: install.sql</p>
]]></content:encoded>
			<wfw:commentRss>http://www.php-log.de/61/mysql/mysql-user-und-datenbank-in-einem-rutsch-uber-die-kommandozeile/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

