<?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>Gerds Blog &#187; PHP</title>
	<atom:link href="http://blog.it4sport.de/category/software/entwicklung/php-entwicklung-software/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.it4sport.de</link>
	<description>Noch so ein Blog ...</description>
	<lastBuildDate>Mon, 28 Nov 2011 17:25:32 +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>hiPHoP</title>
		<link>http://blog.it4sport.de/2010/02/03/hiphop/</link>
		<comments>http://blog.it4sport.de/2010/02/03/hiphop/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 18:28:32 +0000</pubDate>
		<dc:creator>Gerd</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[HipHop]]></category>

		<guid isPermaLink="false">http://blog.it4sport.de/?p=1435</guid>
		<description><![CDATA[Kurze Notiz: Muss mir wenn HipHop fÃ¼r PHP verÃ¶ffentlicht ist das ganze mal ansehen. Vor allem interessiert mich wie der Code nach dem Transformieren aussieht. Mehr Zeilen, weniger lesbar, &#8230;? Bin mal gespannt. Netter Nebeneffekt ist auch, dass die Software danach gleich closed-source wird. Obwohl es dafÃ¼r schon ein paar LÃ¶sungen gibt (etwa Zend-Guard, bcompiler, [...]]]></description>
			<content:encoded><![CDATA[<p>Kurze Notiz: Muss mir wenn <a href="http://developers.facebook.com/news.php?blog=1&#038;story=358">HipHop fÃ¼r PHP</a> verÃ¶ffentlicht ist das ganze mal ansehen. Vor allem interessiert mich wie der Code nach dem Transformieren aussieht.  Mehr Zeilen, weniger lesbar, &#8230;? Bin mal gespannt.<br />
Netter Nebeneffekt ist auch, dass die Software danach gleich closed-source wird. Obwohl es dafÃ¼r schon ein paar LÃ¶sungen gibt (etwa <a href="http://www.zend.com/de/products/guard/">Zend-Guard</a>, <a href="http://pecl.php.net/package/bcompiler">bcompiler</a>, <a href="http://www.ioncube.com/sa_encoder.php">PHPEncoder</a>, &#8230;).  </p>
 <span class="post2pdf_span" style="border: 0px solid gray; width: 160px; text-align: left; "><a href="http://blog.it4sport.de/wp-content/plugins/post2pdf/generate.php?post=›" rel="nofollow"><img src="http://blog.it4sport.de/wp-content/plugins/post2pdf/icon/pdf.png" width="16px" height="16px" /> Artikel als PDF exportieren. </a></span>]]></content:encoded>
			<wfw:commentRss>http://blog.it4sport.de/2010/02/03/hiphop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zeit ist Geld oder PHP Profiling mit XHProf</title>
		<link>http://blog.it4sport.de/2010/01/15/zeit-ist-geld-oder-php-profiling-mit-xhprof/</link>
		<comments>http://blog.it4sport.de/2010/01/15/zeit-ist-geld-oder-php-profiling-mit-xhprof/#comments</comments>
		<pubDate>Thu, 14 Jan 2010 23:03:49 +0000</pubDate>
		<dc:creator>Gerd</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Profiling]]></category>
		<category><![CDATA[XHProf]]></category>

		<guid isPermaLink="false">http://blog.it4sport.de/?p=1422</guid>
		<description><![CDATA[Eben habe ich wieder einen sehr interessanten Artikel von Jan gelesen. Dieses mal geht es um PHP Profiling. Er berichtet Ã¼ber den Einsatz von XHProf von Facebook bei ihnen. Bei Gelegenheit werde ich das Teil unbedingt mal versuchen. FÃ¼r Software, bei der mehr gleichzeitig zugreifen, ist Profiling eigentlich schon immer ein Muss. Viel zu viele [...]]]></description>
			<content:encoded><![CDATA[<p>Eben habe ich wieder <a href="http://www.managingtech.de/2010/01/14/tipp-des-tages-beispiele-fuer-profiling-mit-xhprof/">einen sehr interessanten Artikel</a> von Jan gelesen. Dieses mal geht es um PHP Profiling. Er berichtet Ã¼ber den Einsatz von <a href="http://mirror.facebook.net/facebook/xhprof/doc.html">XHProf</a> von Facebook bei ihnen. </p>
<p>Bei Gelegenheit werde ich das Teil unbedingt mal versuchen. FÃ¼r Software, bei der mehr gleichzeitig zugreifen, ist Profiling eigentlich schon immer ein Muss. Viel zu viele &#8220;Softwareentwickler&#8221; kennen leider solche Tools gar nicht. Ich schreibe mir jedenfalls den Link zu dem Tool unbedingt mal auf. </p>
 <span class="post2pdf_span" style="border: 0px solid gray; width: 160px; text-align: left; "><a href="http://blog.it4sport.de/wp-content/plugins/post2pdf/generate.php?post=Ž" rel="nofollow"><img src="http://blog.it4sport.de/wp-content/plugins/post2pdf/icon/pdf.png" width="16px" height="16px" /> Artikel als PDF exportieren. </a></span>]]></content:encoded>
			<wfw:commentRss>http://blog.it4sport.de/2010/01/15/zeit-ist-geld-oder-php-profiling-mit-xhprof/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP &#8211; aber sicher</title>
		<link>http://blog.it4sport.de/2009/07/30/php-aber-sicher/</link>
		<comments>http://blog.it4sport.de/2009/07/30/php-aber-sicher/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 20:49:45 +0000</pubDate>
		<dc:creator>Gerd</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[IDS]]></category>

		<guid isPermaLink="false">http://blog.it4sport.de/?p=1256</guid>
		<description><![CDATA[PHP Skripts sind schnell gezimmert. Allerdings bleibt da oft die Sicherheit auÃŸen vor. Mir geht es da auch nicht anders. Aus dem Grund suche ich immer wieder nach LÃ¶sungen, die mir die Sache ein wenig abnehmen. Heute bin ich auf PHPIDS gestoÃŸen. Es fÃ¤ngt alle XSS, SQL Injection, header injection, directory traversal, RFE/LFI, DoS und [...]]]></description>
			<content:encoded><![CDATA[<p>PHP Skripts sind schnell gezimmert. Allerdings bleibt da oft die Sicherheit auÃŸen vor. Mir geht es da auch nicht anders. Aus dem Grund suche ich immer wieder nach LÃ¶sungen, die mir die Sache ein wenig abnehmen. Heute bin ich auf <a href="http://php-ids.org">PHPIDS</a> gestoÃŸen. Es fÃ¤ngt alle XSS, SQL Injection, header injection, directory traversal, RFE/LFI, DoS und LDAP Angriffe ab. Die Integration in bestehende PHP Anwendungen lÃ¤uft Ã¼ber ein paar wenige Zeilen Code. Genau dafÃ¼r Ã¼brigens liebe ich die Interpretersprachen. </p>
<p>PHPIDS muss ich mir unbedingt mal installieren!</p>
 <span class="post2pdf_span" style="border: 0px solid gray; width: 160px; text-align: left; "><a href="http://blog.it4sport.de/wp-content/plugins/post2pdf/generate.php?post=è" rel="nofollow"><img src="http://blog.it4sport.de/wp-content/plugins/post2pdf/icon/pdf.png" width="16px" height="16px" /> Artikel als PDF exportieren. </a></span>]]></content:encoded>
			<wfw:commentRss>http://blog.it4sport.de/2009/07/30/php-aber-sicher/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP Notizen</title>
		<link>http://blog.it4sport.de/2009/07/28/php-notizen/</link>
		<comments>http://blog.it4sport.de/2009/07/28/php-notizen/#comments</comments>
		<pubDate>Tue, 28 Jul 2009 14:05:31 +0000</pubDate>
		<dc:creator>Gerd</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Linefeed]]></category>
		<category><![CDATA[Zeilenumbruch]]></category>

		<guid isPermaLink="false">http://blog.it4sport.de/?p=1235</guid>
		<description><![CDATA[Hab mal wieder eben was mit PHP zu tun gehabt. Daher 2 Notizen: Fehlermeldungen in PHP einschalten: Statt immer den Webserver oder die PHP.ini umzustellen reicht natÃ¼rlich auch folgender Code im Skript: error_reporting&#40;E_ALL&#41;; ini_set&#40;'display_errors', '1'&#41;; ZeilenumbrÃ¼che unabhÃ¤ngig vom Betriebssystem: Warum Windows das anders macht als Linux/Unix nervt mich schon immer. Jedenfalls werde ich ab sofort [...]]]></description>
			<content:encoded><![CDATA[<p>Hab mal wieder eben was mit PHP zu tun gehabt. Daher 2 Notizen:</p>
<ol>
<li>Fehlermeldungen in PHP einschalten:<br />
Statt immer den Webserver oder die PHP.ini umzustellen reicht natÃ¼rlich auch folgender Code im Skript:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">error_reporting</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">E_ALL</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">ini_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'display_errors'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'1'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

</li>
<li>ZeilenumbrÃ¼che unabhÃ¤ngig vom Betriebssystem:<br />
Warum Windows das anders macht als Linux/Unix nervt mich schon immer. Jedenfalls werde ich ab sofort statt &#8220;\r\n&#8221; bzw. &#8220;\n&#8221; in Zukunft die PHP Konstante PHP_EOL nehmen! Also sowas wie:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$msg</span> <span style="color: #339933;">.=</span>  PHP_EOL<span style="color: #339933;">;</span></pre></div></div>

</li>
</ol>
 <span class="post2pdf_span" style="border: 0px solid gray; width: 160px; text-align: left; "><a href="http://blog.it4sport.de/wp-content/plugins/post2pdf/generate.php?post=Ó" rel="nofollow"><img src="http://blog.it4sport.de/wp-content/plugins/post2pdf/icon/pdf.png" width="16px" height="16px" /> Artikel als PDF exportieren. </a></span>]]></content:encoded>
			<wfw:commentRss>http://blog.it4sport.de/2009/07/28/php-notizen/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Spiderman is having me for dinner tonight&#8230;. Teil 4</title>
		<link>http://blog.it4sport.de/2009/02/17/spiderman-is-having-me-vor-dinner-tonight-teil-4/</link>
		<comments>http://blog.it4sport.de/2009/02/17/spiderman-is-having-me-vor-dinner-tonight-teil-4/#comments</comments>
		<pubDate>Tue, 17 Feb 2009 09:16:07 +0000</pubDate>
		<dc:creator>Gerd</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.it4sport.de/?p=957</guid>
		<description><![CDATA[Ich hab mir heute morgen mal die Statistik vom Cache angesehen. 99.7% der Hits werden durch mit gecachten PHP-Seiten bedient. Nur bei 0.3% muss die PHP Seite neu in Bytecode Ã¼bersetzt werden. Nicht schlecht! Bei den Seiten, die ich per Hand (s.o.) cache, ist das VerhÃ¤ltnis beeindruckend: 1. Aufruf: Page Load Time: 0.330711126328 seconds. Jeder [...]]]></description>
			<content:encoded><![CDATA[<p>Ich hab mir heute morgen mal die Statistik vom Cache angesehen. <strong>99.7%</strong> der Hits werden durch mit gecachten PHP-Seiten bedient. Nur bei 0.3% muss die PHP Seite neu in Bytecode Ã¼bersetzt werden. Nicht schlecht!</p>
<p>Bei den Seiten, die ich per Hand (<a href="http://blog.it4sport.de/2009/02/16/spiderman-is-having-me-for-dinner-tonight%e2%80%a6-teil-3/">s.o.</a>) cache, ist das VerhÃ¤ltnis beeindruckend:</p>
<ul>
<li>1. Aufruf: Page Load Time: <strong>0.330711126328</strong> seconds.</li>
<li>Jeder weitere Aufruf: Page Load Time: <strong>0.000527143478394</strong> seconds.</li>
</ul>
<p>Das lohnt sich wohl!</p>
 <span class="post2pdf_span" style="border: 0px solid gray; width: 160px; text-align: left; "><a href="http://blog.it4sport.de/wp-content/plugins/post2pdf/generate.php?post=½" rel="nofollow"><img src="http://blog.it4sport.de/wp-content/plugins/post2pdf/icon/pdf.png" width="16px" height="16px" /> Artikel als PDF exportieren. </a></span>]]></content:encoded>
			<wfw:commentRss>http://blog.it4sport.de/2009/02/17/spiderman-is-having-me-vor-dinner-tonight-teil-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Spiderman is having me for dinner tonightâ€¦ Teil 3</title>
		<link>http://blog.it4sport.de/2009/02/16/spiderman-is-having-me-for-dinner-tonight%e2%80%a6-teil-3/</link>
		<comments>http://blog.it4sport.de/2009/02/16/spiderman-is-having-me-for-dinner-tonight%e2%80%a6-teil-3/#comments</comments>
		<pubDate>Mon, 16 Feb 2009 17:10:03 +0000</pubDate>
		<dc:creator>Gerd</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Apache]]></category>

		<guid isPermaLink="false">http://blog.it4sport.de/?p=949</guid>
		<description><![CDATA[Ich hab ja schon in Teil 1 geschrieben, dass ich apc einsetze. Das Teil bringt ohne irgend welche Programmierung schon einiges. Es hÃ¤lt den Bytecode der PHP-Skripts im Speicher. Den Erfolg kann man ganz einfach so abrufen: 1 print_r&#40;apc_cache_info&#40;&#41;&#41;; Mit ein bisschen Programmieraufwand kann man Dank apc noch viel mehr rausholen. Auf rothsee-triathlon.de ist nicht [...]]]></description>
			<content:encoded><![CDATA[<p>Ich hab ja schon in <a href="http://blog.it4sport.de/2009/02/11/spiderman-is-having-me-for-dinner-tonight/">Teil 1</a> geschrieben, dass ich <a href="http://pecl.php.net/package/APC">apc</a> einsetze. Das Teil bringt ohne irgend welche Programmierung schon einiges. Es hÃ¤lt den Bytecode der PHP-Skripts im Speicher. Den Erfolg kann man ganz einfach so abrufen:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">print_r</span><span style="color: #009900;">&#40;</span>apc_cache_info<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Mit ein bisschen Programmieraufwand kann man Dank apc noch viel mehr rausholen. Auf <a href="http://www.rothsee-triathlon.de">rothsee-triathlon.de</a> ist nicht alles neu und in php. Manche Teile laufen auch als alte Perl Skripts im Hintergrund. Die Hole ich mir dann per http zur Laufzeit rein. Nachdem das aber immer wieder die gleichen Files sind lÃ¤sst sich der Content prima cachen. Also hab ich eine Funktion fÃ¼r diesen Zweck definiert:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> request_cache<span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'apc_fetch'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
           <span style="color: #000088;">$md5</span><span style="color: #339933;">=</span><span style="color: #990000;">md5</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
           <span style="color: #000088;">$doc</span> <span style="color: #339933;">=</span> apc_fetch<span style="color: #009900;">&#40;</span><span style="color: #000088;">$md5</span><span style="color: #339933;">,&amp;</span><span style="color: #000088;">$success</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	   <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$success</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$doc</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$doc</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
		apc_store<span style="color: #009900;">&#40;</span><span style="color: #000088;">$md5</span><span style="color: #339933;">,</span> <span style="color: #000088;">$doc</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$doc</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;!-- &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$md5</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; now cached --&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
           <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$doc</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;!-- already cached --&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
           <span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$doc</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$doc</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;!-- not cached --&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$doc</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>und rufe sie wie folgt auf:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$value</span> <span style="color: #339933;">=</span> request_cache<span style="color: #009900;">&#40;</span><span style="color: #000088;">$request</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Die gecachte Seite ist &#8220;nur&#8221; ca. um den Faktor 100 schneller. Kleiner Aufwand hoher Nutzen. Sehr geil. </p>
 <span class="post2pdf_span" style="border: 0px solid gray; width: 160px; text-align: left; "><a href="http://blog.it4sport.de/wp-content/plugins/post2pdf/generate.php?post=µ" rel="nofollow"><img src="http://blog.it4sport.de/wp-content/plugins/post2pdf/icon/pdf.png" width="16px" height="16px" /> Artikel als PDF exportieren. </a></span>]]></content:encoded>
			<wfw:commentRss>http://blog.it4sport.de/2009/02/16/spiderman-is-having-me-for-dinner-tonight%e2%80%a6-teil-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

