<?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>entwicklungsgedanken &#187; php</title>
	<atom:link href="http://www.entwicklungsgedanken.de/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.entwicklungsgedanken.de</link>
	<description>Verschiedene Gedanken rund um die Softwareentwicklung</description>
	<lastBuildDate>Mon, 09 Jan 2012 14:47:42 +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>Solving SOAP-ERROR: Parsing WSDL in PHP</title>
		<link>http://www.entwicklungsgedanken.de/2009/04/20/solving-soap-error-parsing-wsdl-in-php/</link>
		<comments>http://www.entwicklungsgedanken.de/2009/04/20/solving-soap-error-parsing-wsdl-in-php/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 21:21:55 +0000</pubDate>
		<dc:creator>Eric Bartels</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Webdevelopment]]></category>
		<category><![CDATA[https]]></category>
		<category><![CDATA[openssl]]></category>
		<category><![CDATA[parse error]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[SOAP]]></category>
		<category><![CDATA[WSDL]]></category>

		<guid isPermaLink="false">http://www.entwicklungsgedanken.de/?p=244</guid>
		<description><![CDATA[Consuming web services is nothing special nor exciting. In one of my current projects I just did this. Using the web service on my development-system and on the test-system works just fine. However when deploying the module to the production-system and using it an exception is thrown containing the following error: SOAP-ERROR: Parsing WSDL: Couldn't [...]]]></description>
			<content:encoded><![CDATA[<p>Consuming web services is nothing special nor exciting. In one of my current projects I just did this. Using the web service on my development-system and on the test-system works just fine.</p>
<p>However when deploying the module to the production-system and using it an exception is thrown containing the following error:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">SOAP<span style="color: #339933;">-</span>ERROR<span style="color: #339933;">:</span> Parsing WSDL<span style="color: #339933;">:</span> Couldn<span style="color: #0000ff;">'t load from '</span>https<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//my-webservice-provider/service.wsdl'</span></pre></div></div>

<p>This exception was thrown during the initialization of my custom soap client (which derives from <a href="http://www.php.net/manual/de/class.soapclient.php">SoapClient</a>). So what is the problem here? Two systems worked perfectly. One system is causing troubles. The issue is probably not caused by the code itself&#8230;</p>
<h3>Conclusion</h3>
<p>The error message given by the SoapClient is misleading and should be more precise! The openssl extension for PHP (php5-openssl) simply <strong>was not installed</strong> on the production system. Because the service is consumed via https openssl is a requirement.</p>
<p>I would asume an error message like: &#8220;Cannot load openssl extension&#8221; or something like that&#8230; But as <a href="http://en.wikipedia.org/wiki/Test-driven_development">TDD</a> tells you: Don&#8217;t asume anything.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.entwicklungsgedanken.de/2009/04/20/solving-soap-error-parsing-wsdl-in-php/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Solving utf-8-encoding-issues when connecting to oracle with php and oci8</title>
		<link>http://www.entwicklungsgedanken.de/2009/04/06/solving-utf-8-encoding-issues-when-connecting-to-oracle-with-php-and-oci8/</link>
		<comments>http://www.entwicklungsgedanken.de/2009/04/06/solving-utf-8-encoding-issues-when-connecting-to-oracle-with-php-and-oci8/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 20:24:22 +0000</pubDate>
		<dc:creator>Eric Bartels</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Webdevelopment]]></category>
		<category><![CDATA[Encoding]]></category>
		<category><![CDATA[OCI8]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[UTF8]]></category>

		<guid isPermaLink="false">http://www.entwicklungsgedanken.de/?p=223</guid>
		<description><![CDATA[In a recent project of mine a web-application is developed. This application consumes &#8220;some data&#8221; from an enterprise Oracle database. The development environment has the latest oracle drivers installed. Everything works as expected. Even the connection-speed is very good. But then comes the deployment of that application. The production environment already runs for a while [...]]]></description>
			<content:encoded><![CDATA[<p>In a recent project of mine a web-application is developed. This application consumes &#8220;some data&#8221; from an enterprise Oracle database. The development environment has the latest oracle drivers installed. Everything works as expected. Even the connection-speed is very good.<br />
But then comes the deployment of that application. The production environment already runs for a while and hosts a certain amount of applications. Oracle driver had been installed a while ago.</p>
<h3>Here comes trouble&#8230;</h3>
<p>Both environments (production and dev/test-system) connect to the same Oracle database. Inside the production environment all data received from the Oracle database is corrupt due to wrong encoding. A simple <code>mb_detect_encoding</code> shows &#8216;UTF8&#8242; which cannot be. The whole web-application &#8220;is&#8221; utf-8. There is no implicit or explicit conversion of encodings performed. So the problem must be caused by the Oracle drivers themselves.</p>
<h3>Fixme</h3>
<p>setlocale did not work. The encoding option in the dsn (connection string) did not work. What did work was setting the <code>NLS_LANG</code> in the registry. The key can be found inside <code>HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\{SomeInstance}</code>. In this case the <code>NLS_LANG</code> was set to <code>GERMAN_GERMANY.UTF8</code>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.entwicklungsgedanken.de/2009/04/06/solving-utf-8-encoding-issues-when-connecting-to-oracle-with-php-and-oci8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Geocoding über HTTP mit dem Google-Maps Geocoding-Service</title>
		<link>http://www.entwicklungsgedanken.de/2008/03/07/geocoding-uber-http-mit-dem-google-maps-geocoding-service/</link>
		<comments>http://www.entwicklungsgedanken.de/2008/03/07/geocoding-uber-http-mit-dem-google-maps-geocoding-service/#comments</comments>
		<pubDate>Fri, 07 Mar 2008 16:14:40 +0000</pubDate>
		<dc:creator>Eric Bartels</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Webdevelopment]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[geocoding-service]]></category>
		<category><![CDATA[google-maps]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.entwicklungsgedanken.de/2008/03/07/geocoding-uber-http-mit-dem-google-maps-geocoding-service/</guid>
		<description><![CDATA[Der Google-Maps-Service ermöglicht Geocoding mittels HTTP-Anfragen. Eine feine Sache und dank JSON als Rückgabeformat und json_decode sehr einfach zu nutzen. Problem mit dem Encoding und json_decode Der folgende Code liefert nicht das erwartete Ergebnis. Die Funktion json_decode liefert für die Antwort ein &#8220;leeres Ergebnis&#8221;. Eine Analyse von $reponse zeigt einen fehlerhaft codierten String. Das ß [...]]]></description>
			<content:encoded><![CDATA[<div class="lang-de"></div>
<p>Der Google-Maps-Service ermöglicht <a href="http://code.google.com/apis/maps/documentation/services.html#Geocoding_Direct">Geocoding mittels HTTP-Anfragen</a>. Eine feine Sache und dank JSON als Rückgabeformat und <a href="http://de.php.net/manual/en/function.json-decode.php">json_decode</a> sehr einfach zu nutzen.</p>
<h4>Problem mit dem Encoding und json_decode</h4>
<p>Der folgende Code liefert <strong>nicht das erwartete Ergebnis</strong>. Die Funktion json_decode liefert für die Antwort ein &#8220;leeres Ergebnis&#8221;.</p>
<p>Eine Analyse von <code>$reponse</code> zeigt einen fehlerhaft codierten String. Das ß ist falsch codiert, obwohl der Reponse in UTF-8 vorliegt (vorliegen sollte).</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Hinweis: Fehlerauswertung fehlt hier gänzlich,</span>
<span style="color: #666666; font-style: italic;">// was in produktivem Code nicht sein darf!</span>
<span style="color: #000088;">$handle</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_init</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$url</span>    <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://maps.google.de/maps/geo?key=myKey&amp;output=json&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$url</span>   <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&amp;q=Vollmerhauser Straße 115, 51645 Gummersbach, Deutschland&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Set curl options</span>
<span style="color: #990000;">curl_setopt</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$handle</span><span style="color: #339933;">,</span> CURLOPT_URL<span style="color: #339933;">,</span> <span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$handle</span><span style="color: #339933;">,</span> CURLOPT_RETURNTRANSFER<span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Get code and parse json</span>
<span style="color: #000088;">$response</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_exec</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$handle</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$json</span>     <span style="color: #339933;">=</span> <span style="color: #990000;">json_decode</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$response</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #990000;">curl_close</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$handle</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Fügt man jedoch einen User-Agent als curl-option (<strong>CURLOPT_USERAGENT</strong>) hinzu, ist das Ergebnis korrekt und json_decode verrichtet seinen Dienst, wie erwartet. Ein sehr seltsames Verhalten&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// ... Code siehe oben</span>
<span style="color: #990000;">curl_setopt</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$handle</span><span style="color: #339933;">,</span> CURLOPT_USERAGENT<span style="color: #339933;">,</span> 
    <span style="color: #0000ff;">'Mozilla/5.0 (X11; U; Linux i686; de-DE; rv:1.7.6) Gecko/20050309 Firefox/1.0.1'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// ... Code siehe oben</span></pre></div></div>

<h4>StatusCode 620 (G_GEO_TOO_MANY_QUERIES)</h4>
<p>Der Geocoder liefert eigene Response-Codes (GGeoStatusCode) um den Status der Geocodierung anzuzeigen. Bei vielen Anfragen tritt häufig der Response-Code 620 (G_GEO_TOO_MANY_QUERIES) auf.</p>
<p>
Google beschränkt also die Anzahl der Geocoding-Operation pro Sekunde. Deshalb müssen die Anfragen limitiert werden.
</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Warte 100ms</span>
<span style="color: #990000;">usleep</span> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">100000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Nun sinkt natürlich der Datendurchsatz, aber damit kann man leben, denn die Anfragen werden richtig beantwortet. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.entwicklungsgedanken.de/2008/03/07/geocoding-uber-http-mit-dem-google-maps-geocoding-service/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Reminder] Disable output-buffering when sending a download to the browser</title>
		<link>http://www.entwicklungsgedanken.de/2008/01/19/reminder-disable-output-buffering-when-sending-a-download-to-the-browser/</link>
		<comments>http://www.entwicklungsgedanken.de/2008/01/19/reminder-disable-output-buffering-when-sending-a-download-to-the-browser/#comments</comments>
		<pubDate>Sat, 19 Jan 2008 09:24:35 +0000</pubDate>
		<dc:creator>Eric Bartels</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Verschiedenes]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[file-download]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[output-buffering]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.entwicklungsgedanken.de/2008/01/19/reminder-disable-output-buffering-when-sending-a-download-to-the-browser/</guid>
		<description><![CDATA[If you want to &#8220;send a file&#8221; to the browser (even if you do it in chunks) and your output-buffering is on you will get a fatal error when having large files. Fatal error: Allowed memory size of 0815 bytes exhausted It makes sense. The data of the file gets buffered. And after a while [...]]]></description>
			<content:encoded><![CDATA[<div class="lang-en"></div>
<p>If you want to &#8220;send a file&#8221; to the browser (even if you do it in chunks) and your <a href="http://de.php.net/manual/en/ref.outcontrol.php">output-buffering</a> is on you will get a fatal error when having large files.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">Fatal error<span style="color: #339933;">:</span> Allowed memory size of <span style="color:#800080;">0815</span> bytes exhausted</pre></div></div>

<p>It makes sense. The data of the file gets buffered. And after a while the buffer is full.</p>
<p>
<strong>Always</strong> disable your <a href="http://de.php.net/manual/en/ref.outcontrol.php">output-buffering</a> before you start sending chunks of data (which represent a file download).
</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">ob_end_clean</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.entwicklungsgedanken.de/2008/01/19/reminder-disable-output-buffering-when-sending-a-download-to-the-browser/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

