<?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>The Troll&#039;s factory &#187; php</title>
	<atom:link href="http://trollfactory.fr/tag/php/feed" rel="self" type="application/rss+xml" />
	<link>http://trollfactory.fr</link>
	<description>Geekeries &#38; pensées</description>
	<lastBuildDate>Mon, 09 Jun 2014 19:43:25 +0000</lastBuildDate>
	<language>fr-FR</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.41</generator>
	<item>
		<title>PHP: USE concatenation NOT multiple echo / parameters</title>
		<link>http://trollfactory.fr/php-use-concatenation-not-multiple-echo-parameters-586</link>
		<comments>http://trollfactory.fr/php-use-concatenation-not-multiple-echo-parameters-586#comments</comments>
		<pubDate>Sun, 12 Aug 2012 22:21:54 +0000</pubDate>
		<dc:creator><![CDATA[Troll]]></dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Scripts, astuces, dév. web]]></category>
		<category><![CDATA[benchmark]]></category>
		<category><![CDATA[echo]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[print]]></category>

		<guid isPermaLink="false">http://trollfactory.fr/?p=586</guid>
		<description><![CDATA[Print vs. Echo I just went accross an interesting article about which of &#171;&#160;print&#160;&#187; or &#171;&#160;echo&#160;&#187; we should use in PHP. The author has benchmarked the two solutions (though the data are certainly a bit old) shows that, although there is not much difference between the two, echo seems to be more efficient. Great, I [...]]]></description>
				<content:encoded><![CDATA[<h2>Print vs. Echo</h2>
<p>I just went accross an interesting article about which of &laquo;&nbsp;print&nbsp;&raquo; or &laquo;&nbsp;echo&nbsp;&raquo; we should use in PHP.</p>
<p>The author has benchmarked the two solutions (though the data are certainly a bit old) shows that, although there is not much difference between the two, echo seems to be more efficient.</p>
<p>Great, I believe you.</p>
<h2>Echo multiple statements / arguments vs. Concatenation</h2>
<p>But at the end of the article, the author also suggest to use <strong>multiple parameters</strong> given to one echo statement <strong>instead of concatenation because concatenation is slow&#8230;</strong> bla bla&#8230;</p>
<p>As I have always been using concatenation (did not even know echo could take multiple arguments) and I never had any performance issue, I decided to check that and make a benchmark: echo 100,000 times two concatenated strings and do the same thing with two parameters and two echos statements&#8230;</p>
<p><strong>The benchmark was clear: concatenation IS FASTER</strong> than the two other solutions.</p>
<h2>String caching? Making a more relevant benchmark</h2>
<p>As it appeared a bit weird to me, having been doing Java / C# mostly recently (with their slow concatenation that recreated a new object blabla), I thought &laquo;&nbsp;maybe the PHP VM is <strong>caching</strong> the result of the concatenated string, thus the benchmark is not relevant&nbsp;&raquo;.</p>
<p>OK, let&rsquo;s check with a counter-possible-caching benchmark then:</p>
<pre>

$t0 = microtime(true);

define("MAX", 2000000);
File_put_ConTents("echobench._log", "");
function _log($str)
{
	File_put_ConTents("echobench._log", file_get_contents("echobench._log") . $str);
}

// Generating a bunch of string to concatenate to avoid PHP VM-caching
$strs = array();
for ($i=0; $i < MAX+1; $i++) { 
	$m = mt_rand(0, 200);
	$strs[$i] = '';
	for ($j=0; $j < $m; $j++) { 
		$strs[$i] .= chr(mt_rand(0, 255));
	}
}

// Loop where string concatenation caching is possible :
$t1 = microtime(true);
for ($i=0; $i < MAX; $i++) { 
	echo "Hello" . "World! <br />";
}
$t2 = microtime(true);
_log("Concatenation, cached: " . ($t2-$t1) . "s\n");

// Loop where is is not :
$t1 = microtime(true);
for ($i=0; $i < MAX; $i++) { 
	echo $strs[$i] . $strs[$i + 1];
}
$t2 = microtime(true);
_log("Concatenation, not cached: " . ($t2-$t1) . "s\n");

// Other ways to display stuff, with and without caching possible each time:
$t1 = microtime(true);
for ($i=0; $i < MAX; $i++) { 
	echo $strs[$i];
	echo $strs[$i + 1];
}
$t2 = microtime(true);
_log("Two echos, not cached: " . ($t2-$t1) . "s\n");

$t1 = microtime(true);
for ($i=0; $i < MAX; $i++) { 
	echo "Hello" , "<br />";
	echo "World" , "<br />";
}
$t2 = microtime(true);
_log("Two echos, cached: " . ($t2-$t1) . "s\n");

$t1 = microtime(true);
for ($i=0; $i < MAX; $i++) { 
	echo $strs[$i], $strs[$i + 1];;
}
$t2 = microtime(true);
_log("Two parameters, not cached: " . ($t2-$t1) . "s\n");

$t1 = microtime(true);
for ($i=0; $i < MAX; $i++) { 
	echo "Hello" , "World!" , "<br />";
}
$t2 = microtime(true);
_log("Two parameters, cached: " . ($t2-$t1) . "s\n");

$t3 = microtime(true);

_log("Total benchmark time: " . ($t3-$t0)."\n");

</pre>
<p>I generated <strong>random strings</strong> at the beginning of the script. And I concatenate them after, in the loop. Thus, there is not even once the same concatenation happening, thus, no possible caching or whatever.</p>
<p>The benchmarked has been run on a 1.6GHz Atom processor, with the following command: </p>
<pre>sudo nice -n -19 php -q echobanchmark.php > /dev/null</pre>
<p>So the process was the most prioritized one on the OS and then there is no reason for any interference between the loops (moreover, the system was idle during the test (and there are 3 other virtual processors for doing whatever work the OS would need to do).</p>
<h3>And do you know the result?</h3>
<p>Here it goes: </p>
<p>Concatenation, cached: <strong>7.4381861686707s</strong><br />
Concatenation, not cached: <strong>9.9010219573975s</strong><br />
Two echos, not cached: <strong>10.4353120327s</strong><br />
Two echos, cached: <strong>14.883654117584s</strong><br />
Two parameters, not cached: <strong>10.179102897644s</strong><br />
Two parameters, cached: <strong>11.904446840286s</strong><br />
Total benchmark time: 928.97792601585</p>
<p><strong>Conclusion: Concatenation is fast, very fast.</strong> It is rougly <strong>30% faster</strong> than using the two parameters for echo (26.9268987% exactly) and roughly <strong>30% faster</strong> than two echo statements as well (28.720999% exactly) and <strong></p>
<p>The other conclusion here is that <srtong>PHP does not seem to be caching strings very well</strong>. Both the two-parameters and two-statements echo loops are <strong>much slower when using a fresh new string and much faster when using something from the previously generated array</strong>. The difference between cached / non-cached loop for the concatenation loop is also not that impressive if we observe that my &laquo;&nbsp;not cached&nbsp;&raquo; loop is using strings of random length that can go until 200 chars whereas the &laquo;&nbsp;cached&nbsp;&raquo; one is a very short string (so the difference of 2 seconds is certainly also due to the difference in length of the strings).</p>
<p>If you have any suggestion to improve the benchmark, feel free to post a comment.</p>
Share and Enjoy:<a rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Ftrollfactory.fr%2Fphp-use-concatenation-not-multiple-echo-parameters-586" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/printfriendly.png" class="sociable-img sociable-hovers" title="Print" alt="Print" /></a><a rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Ftrollfactory.fr%2Fphp-use-concatenation-not-multiple-echo-parameters-586" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/pdf.png" class="sociable-img sociable-hovers" title="PDF" alt="PDF" /></a><a rel="nofollow" target="_blank"  href="http://twitter.com/home?status=PHP%3A%20USE%20concatenation%20NOT%20multiple%20echo%20%2F%20parameters%20-%20http%3A%2F%2Ftrollfactory.fr%2Fphp-use-concatenation-not-multiple-echo-parameters-586" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/twitter.png" class="sociable-img sociable-hovers" title="Twitter" alt="Twitter" /></a><a rel="nofollow" target="_blank"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Ftrollfactory.fr%2Fphp-use-concatenation-not-multiple-echo-parameters-586&amp;t=PHP%3A%20USE%20concatenation%20NOT%20multiple%20echo%20%2F%20parameters" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/facebook.png" class="sociable-img sociable-hovers" title="Facebook" alt="Facebook" /></a><a rel="nofollow" target="_blank"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Ftrollfactory.fr%2Fphp-use-concatenation-not-multiple-echo-parameters-586&amp;title=PHP%3A%20USE%20concatenation%20NOT%20multiple%20echo%20%2F%20parameters&amp;source=The+Troll%26%23039%3Bs+factory+Geekeries+%26amp%3B+pens%C3%A9es&amp;summary=Print%20vs.%20Echo%0D%0A%0D%0AI%20just%20went%20accross%20an%20interesting%20article%20about%20which%20of%20%22print%22%20or%20%22echo%22%20we%20should%20use%20in%20PHP.%0D%0A%0D%0AThe%20author%20has%20benchmarked%20the%20two%20solutions%20%28though%20the%20data%20are%20certainly%20a%20bit%20old%29%20shows%20that%2C%20although%20there%20is%20not%20much%20diffe" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/linkedin.png" class="sociable-img sociable-hovers" title="LinkedIn" alt="LinkedIn" /></a><a rel="nofollow" target="_blank"  href="http://trollfactory.fr/feed" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/rss.png" class="sociable-img sociable-hovers" title="RSS" alt="RSS" /></a><a rel="nofollow" target="_blank"  href="http://www.wikio.fr/vote?url=http%3A%2F%2Ftrollfactory.fr%2Fphp-use-concatenation-not-multiple-echo-parameters-586" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/wikio.png" class="sociable-img sociable-hovers" title="Wikio FR" alt="Wikio FR" /></a><a rel="nofollow" target="_blank"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Ftrollfactory.fr%2Fphp-use-concatenation-not-multiple-echo-parameters-586&amp;title=PHP%3A%20USE%20concatenation%20NOT%20multiple%20echo%20%2F%20parameters&amp;bodytext=Print%20vs.%20Echo%0D%0A%0D%0AI%20just%20went%20accross%20an%20interesting%20article%20about%20which%20of%20%22print%22%20or%20%22echo%22%20we%20should%20use%20in%20PHP.%0D%0A%0D%0AThe%20author%20has%20benchmarked%20the%20two%20solutions%20%28though%20the%20data%20are%20certainly%20a%20bit%20old%29%20shows%20that%2C%20although%20there%20is%20not%20much%20diffe" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/digg.png" class="sociable-img sociable-hovers" title="Digg" alt="Digg" /></a><a rel="nofollow" target="_blank"  href="http://delicious.com/post?url=http%3A%2F%2Ftrollfactory.fr%2Fphp-use-concatenation-not-multiple-echo-parameters-586&amp;title=PHP%3A%20USE%20concatenation%20NOT%20multiple%20echo%20%2F%20parameters&amp;notes=Print%20vs.%20Echo%0D%0A%0D%0AI%20just%20went%20accross%20an%20interesting%20article%20about%20which%20of%20%22print%22%20or%20%22echo%22%20we%20should%20use%20in%20PHP.%0D%0A%0D%0AThe%20author%20has%20benchmarked%20the%20two%20solutions%20%28though%20the%20data%20are%20certainly%20a%20bit%20old%29%20shows%20that%2C%20although%20there%20is%20not%20much%20diffe" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/delicious.png" class="sociable-img sociable-hovers" title="del.icio.us" alt="del.icio.us" /></a><a rel="nofollow" target="_blank"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Ftrollfactory.fr%2Fphp-use-concatenation-not-multiple-echo-parameters-586&amp;title=PHP%3A%20USE%20concatenation%20NOT%20multiple%20echo%20%2F%20parameters&amp;annotation=Print%20vs.%20Echo%0D%0A%0D%0AI%20just%20went%20accross%20an%20interesting%20article%20about%20which%20of%20%22print%22%20or%20%22echo%22%20we%20should%20use%20in%20PHP.%0D%0A%0D%0AThe%20author%20has%20benchmarked%20the%20two%20solutions%20%28though%20the%20data%20are%20certainly%20a%20bit%20old%29%20shows%20that%2C%20although%20there%20is%20not%20much%20diffe" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/googlebookmark.png" class="sociable-img sociable-hovers" title="Google Bookmarks" alt="Google Bookmarks" /></a><a rel="nofollow" target="_blank"  href="http://technorati.com/faves?add=http%3A%2F%2Ftrollfactory.fr%2Fphp-use-concatenation-not-multiple-echo-parameters-586" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/technorati.png" class="sociable-img sociable-hovers" title="Technorati" alt="Technorati" /></a><a rel="nofollow" target="_blank"  href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Ftrollfactory.fr%2Fphp-use-concatenation-not-multiple-echo-parameters-586" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/sphinn.png" class="sociable-img sociable-hovers" title="Sphinn" alt="Sphinn" /></a><a rel="nofollow" target="_blank"  href="http://www.mixx.com/submit?page_url=http%3A%2F%2Ftrollfactory.fr%2Fphp-use-concatenation-not-multiple-echo-parameters-586&amp;title=PHP%3A%20USE%20concatenation%20NOT%20multiple%20echo%20%2F%20parameters" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/mixx.png" class="sociable-img sociable-hovers" title="Mixx" alt="Mixx" /></a><a rel="nofollow" target="_blank" title="Add to favorites" href="#" onclick="AddToFavorites(); return false;"><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/addtofavorites.png" class="sociable-img sociable-hovers" title="Add to favorites" alt="Add to favorites" /></a><a rel="nofollow" target="_blank"  href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Ftrollfactory.fr%2Fphp-use-concatenation-not-multiple-echo-parameters-586&amp;title=PHP%3A%20USE%20concatenation%20NOT%20multiple%20echo%20%2F%20parameters" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/live.png" class="sociable-img sociable-hovers" title="Live" alt="Live" /></a><a rel="nofollow" target="_blank"  href="http://www.netvibes.com/share?title=PHP%3A%20USE%20concatenation%20NOT%20multiple%20echo%20%2F%20parameters&amp;url=http%3A%2F%2Ftrollfactory.fr%2Fphp-use-concatenation-not-multiple-echo-parameters-586" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/netvibes.png" class="sociable-img sociable-hovers" title="Netvibes" alt="Netvibes" /></a><a rel="nofollow" target="_blank"  href="http://www.scoopeo.com/scoop/new?newurl=http%3A%2F%2Ftrollfactory.fr%2Fphp-use-concatenation-not-multiple-echo-parameters-586&amp;title=PHP%3A%20USE%20concatenation%20NOT%20multiple%20echo%20%2F%20parameters" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/scoopeo.png" class="sociable-img sociable-hovers" title="Scoopeo" alt="Scoopeo" /></a><a rel="nofollow" target="_blank"  href="http://www.viadeo.com/shareit/share/?url=http%3A%2F%2Ftrollfactory.fr%2Fphp-use-concatenation-not-multiple-echo-parameters-586&title=PHP%3A%20USE%20concatenation%20NOT%20multiple%20echo%20%2F%20parameters&urllanguage=fr" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/viadeo.png" class="sociable-img sociable-hovers" title="viadeo FR" alt="viadeo FR" /></a><a rel="nofollow" target="_blank"  href="http://identi.ca/notice/new?status_textarea=http%3A%2F%2Ftrollfactory.fr%2Fphp-use-concatenation-not-multiple-echo-parameters-586" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/identica.png" class="sociable-img sociable-hovers" title="Identi.ca" alt="Identi.ca" /></a><a rel="nofollow" target="_blank"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Ftrollfactory.fr%2Fphp-use-concatenation-not-multiple-echo-parameters-586&amp;t=PHP%3A%20USE%20concatenation%20NOT%20multiple%20echo%20%2F%20parameters" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/myspace.png" class="sociable-img sociable-hovers" title="MySpace" alt="MySpace" /></a><a rel="nofollow" target="_blank"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Ftrollfactory.fr%2Fphp-use-concatenation-not-multiple-echo-parameters-586&amp;title=PHP%3A%20USE%20concatenation%20NOT%20multiple%20echo%20%2F%20parameters" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/stumbleupon.png" class="sociable-img sociable-hovers" title="StumbleUpon" alt="StumbleUpon" /></a><a rel="nofollow" target="_blank"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Ftrollfactory.fr%2Fphp-use-concatenation-not-multiple-echo-parameters-586&amp;submitHeadline=PHP%3A%20USE%20concatenation%20NOT%20multiple%20echo%20%2F%20parameters&amp;submitSummary=Print%20vs.%20Echo%0D%0A%0D%0AI%20just%20went%20accross%20an%20interesting%20article%20about%20which%20of%20%22print%22%20or%20%22echo%22%20we%20should%20use%20in%20PHP.%0D%0A%0D%0AThe%20author%20has%20benchmarked%20the%20two%20solutions%20%28though%20the%20data%20are%20certainly%20a%20bit%20old%29%20shows%20that%2C%20although%20there%20is%20not%20much%20diffe&amp;submitCategory=science&amp;submitAssetType=text" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/yahoobuzz.png" class="sociable-img sociable-hovers" title="Yahoo! Buzz" alt="Yahoo! Buzz" /></a><br/><br/>]]></content:encoded>
			<wfw:commentRss>http://trollfactory.fr/php-use-concatenation-not-multiple-echo-parameters-586/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OH MY GOD On pouvait faire comme ça !?</title>
		<link>http://trollfactory.fr/oh-my-god-on-pouvait-faire-comme-ca-515</link>
		<comments>http://trollfactory.fr/oh-my-god-on-pouvait-faire-comme-ca-515#comments</comments>
		<pubDate>Wed, 06 Jul 2011 18:06:35 +0000</pubDate>
		<dc:creator><![CDATA[Troll]]></dc:creator>
				<category><![CDATA[astuces]]></category>
		<category><![CDATA[Geekeries]]></category>
		<category><![CDATA[astuce]]></category>
		<category><![CDATA[caractère]]></category>
		<category><![CDATA[char]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[string]]></category>

		<guid isPermaLink="false">http://trollfactory.fr/?p=515</guid>
		<description><![CDATA[(pour Google quand même : Récupérer le Xème caractère d&#8217;une string / chaîne de caractère en PHP ) Putain de programmeurs Perl, pourquoi ils savent faire des trucs en PHP que les programmeurs PHP savent pas faire ? Depuis le temps que je grognais contre le fait qu&#8217;en C ou même en Pascal on peut [...]]]></description>
				<content:encoded><![CDATA[<p>(pour Google quand même : <strong>Récupérer le Xème caractère d&rsquo;une string / chaîne de caractère en PHP</strong> )<br />
Putain de programmeurs Perl, pourquoi ils savent faire des trucs <strong>en PHP </strong>que les programmeurs PHP savent pas faire ?</p>
<p>Depuis le temps que je grognais contre le fait qu&rsquo;en C ou même en Pascal on peut accéder au caractère X d&rsquo;une chaine de caractère en faisant machaine[X] et qu&rsquo;en PHP on peut pas&#8230; Et depuis le temps que j&rsquo;utilisais à la place <strong>substr($str, X-1, X)</strong> !!!!</p>
<p>Eh ben en fait, suffit de faire ça :</p>
<p><code>$mastring{X}</code></p>
<p>Fuck, j&rsquo;m&rsquo;en veux là.</p>
<p>Bon ben du coup c&rsquo;est la révolution : je sais faire ça et en plus c&rsquo;est le deuxième billet super court que je fais en 2 jours.</p>
<p>Désolé pour les non-geeks qui auront rien compris à ce post, il faut bien des fois aussi hein, regardez, moi je comprends rien aux posts <a href="http://chroniquesdefemmes.com/">qui sont postés là-bas</a> eh ben tant pis, je me dis que c&rsquo;est normal ! <img src="//trollfactory.fr/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" /></p>
Share and Enjoy:<a rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Ftrollfactory.fr%2Foh-my-god-on-pouvait-faire-comme-ca-515" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/printfriendly.png" class="sociable-img sociable-hovers" title="Print" alt="Print" /></a><a rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Ftrollfactory.fr%2Foh-my-god-on-pouvait-faire-comme-ca-515" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/pdf.png" class="sociable-img sociable-hovers" title="PDF" alt="PDF" /></a><a rel="nofollow" target="_blank"  href="http://twitter.com/home?status=OH%20MY%20GOD%20On%20pouvait%20faire%20comme%20%C3%A7a%20%21%3F%20-%20http%3A%2F%2Ftrollfactory.fr%2Foh-my-god-on-pouvait-faire-comme-ca-515" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/twitter.png" class="sociable-img sociable-hovers" title="Twitter" alt="Twitter" /></a><a rel="nofollow" target="_blank"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Ftrollfactory.fr%2Foh-my-god-on-pouvait-faire-comme-ca-515&amp;t=OH%20MY%20GOD%20On%20pouvait%20faire%20comme%20%C3%A7a%20%21%3F" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/facebook.png" class="sociable-img sociable-hovers" title="Facebook" alt="Facebook" /></a><a rel="nofollow" target="_blank"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Ftrollfactory.fr%2Foh-my-god-on-pouvait-faire-comme-ca-515&amp;title=OH%20MY%20GOD%20On%20pouvait%20faire%20comme%20%C3%A7a%20%21%3F&amp;source=The+Troll%26%23039%3Bs+factory+Geekeries+%26amp%3B+pens%C3%A9es&amp;summary=%28pour%20Google%20quand%20m%C3%AAme%20%3A%20R%C3%A9cup%C3%A9rer%20le%20X%C3%A8me%20caract%C3%A8re%20d%27une%20string%20%2F%20cha%C3%AEne%20de%20caract%C3%A8re%20en%20PHP%20%29%0D%0APutain%20de%20programmeurs%20Perl%2C%20pourquoi%20ils%20savent%20faire%20des%20trucs%20en%20PHP%20que%20les%20programmeurs%20PHP%20savent%20pas%20faire%20%3F%0D%0A%0D%0ADepuis%20le%20temps%20que%20je%20gr" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/linkedin.png" class="sociable-img sociable-hovers" title="LinkedIn" alt="LinkedIn" /></a><a rel="nofollow" target="_blank"  href="http://trollfactory.fr/feed" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/rss.png" class="sociable-img sociable-hovers" title="RSS" alt="RSS" /></a><a rel="nofollow" target="_blank"  href="http://www.wikio.fr/vote?url=http%3A%2F%2Ftrollfactory.fr%2Foh-my-god-on-pouvait-faire-comme-ca-515" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/wikio.png" class="sociable-img sociable-hovers" title="Wikio FR" alt="Wikio FR" /></a><a rel="nofollow" target="_blank"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Ftrollfactory.fr%2Foh-my-god-on-pouvait-faire-comme-ca-515&amp;title=OH%20MY%20GOD%20On%20pouvait%20faire%20comme%20%C3%A7a%20%21%3F&amp;bodytext=%28pour%20Google%20quand%20m%C3%AAme%20%3A%20R%C3%A9cup%C3%A9rer%20le%20X%C3%A8me%20caract%C3%A8re%20d%27une%20string%20%2F%20cha%C3%AEne%20de%20caract%C3%A8re%20en%20PHP%20%29%0D%0APutain%20de%20programmeurs%20Perl%2C%20pourquoi%20ils%20savent%20faire%20des%20trucs%20en%20PHP%20que%20les%20programmeurs%20PHP%20savent%20pas%20faire%20%3F%0D%0A%0D%0ADepuis%20le%20temps%20que%20je%20gr" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/digg.png" class="sociable-img sociable-hovers" title="Digg" alt="Digg" /></a><a rel="nofollow" target="_blank"  href="http://delicious.com/post?url=http%3A%2F%2Ftrollfactory.fr%2Foh-my-god-on-pouvait-faire-comme-ca-515&amp;title=OH%20MY%20GOD%20On%20pouvait%20faire%20comme%20%C3%A7a%20%21%3F&amp;notes=%28pour%20Google%20quand%20m%C3%AAme%20%3A%20R%C3%A9cup%C3%A9rer%20le%20X%C3%A8me%20caract%C3%A8re%20d%27une%20string%20%2F%20cha%C3%AEne%20de%20caract%C3%A8re%20en%20PHP%20%29%0D%0APutain%20de%20programmeurs%20Perl%2C%20pourquoi%20ils%20savent%20faire%20des%20trucs%20en%20PHP%20que%20les%20programmeurs%20PHP%20savent%20pas%20faire%20%3F%0D%0A%0D%0ADepuis%20le%20temps%20que%20je%20gr" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/delicious.png" class="sociable-img sociable-hovers" title="del.icio.us" alt="del.icio.us" /></a><a rel="nofollow" target="_blank"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Ftrollfactory.fr%2Foh-my-god-on-pouvait-faire-comme-ca-515&amp;title=OH%20MY%20GOD%20On%20pouvait%20faire%20comme%20%C3%A7a%20%21%3F&amp;annotation=%28pour%20Google%20quand%20m%C3%AAme%20%3A%20R%C3%A9cup%C3%A9rer%20le%20X%C3%A8me%20caract%C3%A8re%20d%27une%20string%20%2F%20cha%C3%AEne%20de%20caract%C3%A8re%20en%20PHP%20%29%0D%0APutain%20de%20programmeurs%20Perl%2C%20pourquoi%20ils%20savent%20faire%20des%20trucs%20en%20PHP%20que%20les%20programmeurs%20PHP%20savent%20pas%20faire%20%3F%0D%0A%0D%0ADepuis%20le%20temps%20que%20je%20gr" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/googlebookmark.png" class="sociable-img sociable-hovers" title="Google Bookmarks" alt="Google Bookmarks" /></a><a rel="nofollow" target="_blank"  href="http://technorati.com/faves?add=http%3A%2F%2Ftrollfactory.fr%2Foh-my-god-on-pouvait-faire-comme-ca-515" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/technorati.png" class="sociable-img sociable-hovers" title="Technorati" alt="Technorati" /></a><a rel="nofollow" target="_blank"  href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Ftrollfactory.fr%2Foh-my-god-on-pouvait-faire-comme-ca-515" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/sphinn.png" class="sociable-img sociable-hovers" title="Sphinn" alt="Sphinn" /></a><a rel="nofollow" target="_blank"  href="http://www.mixx.com/submit?page_url=http%3A%2F%2Ftrollfactory.fr%2Foh-my-god-on-pouvait-faire-comme-ca-515&amp;title=OH%20MY%20GOD%20On%20pouvait%20faire%20comme%20%C3%A7a%20%21%3F" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/mixx.png" class="sociable-img sociable-hovers" title="Mixx" alt="Mixx" /></a><a rel="nofollow" target="_blank" title="Add to favorites" href="#" onclick="AddToFavorites(); return false;"><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/addtofavorites.png" class="sociable-img sociable-hovers" title="Add to favorites" alt="Add to favorites" /></a><a rel="nofollow" target="_blank"  href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Ftrollfactory.fr%2Foh-my-god-on-pouvait-faire-comme-ca-515&amp;title=OH%20MY%20GOD%20On%20pouvait%20faire%20comme%20%C3%A7a%20%21%3F" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/live.png" class="sociable-img sociable-hovers" title="Live" alt="Live" /></a><a rel="nofollow" target="_blank"  href="http://www.netvibes.com/share?title=OH%20MY%20GOD%20On%20pouvait%20faire%20comme%20%C3%A7a%20%21%3F&amp;url=http%3A%2F%2Ftrollfactory.fr%2Foh-my-god-on-pouvait-faire-comme-ca-515" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/netvibes.png" class="sociable-img sociable-hovers" title="Netvibes" alt="Netvibes" /></a><a rel="nofollow" target="_blank"  href="http://www.scoopeo.com/scoop/new?newurl=http%3A%2F%2Ftrollfactory.fr%2Foh-my-god-on-pouvait-faire-comme-ca-515&amp;title=OH%20MY%20GOD%20On%20pouvait%20faire%20comme%20%C3%A7a%20%21%3F" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/scoopeo.png" class="sociable-img sociable-hovers" title="Scoopeo" alt="Scoopeo" /></a><a rel="nofollow" target="_blank"  href="http://www.viadeo.com/shareit/share/?url=http%3A%2F%2Ftrollfactory.fr%2Foh-my-god-on-pouvait-faire-comme-ca-515&title=OH%20MY%20GOD%20On%20pouvait%20faire%20comme%20%C3%A7a%20%21%3F&urllanguage=fr" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/viadeo.png" class="sociable-img sociable-hovers" title="viadeo FR" alt="viadeo FR" /></a><a rel="nofollow" target="_blank"  href="http://identi.ca/notice/new?status_textarea=http%3A%2F%2Ftrollfactory.fr%2Foh-my-god-on-pouvait-faire-comme-ca-515" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/identica.png" class="sociable-img sociable-hovers" title="Identi.ca" alt="Identi.ca" /></a><a rel="nofollow" target="_blank"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Ftrollfactory.fr%2Foh-my-god-on-pouvait-faire-comme-ca-515&amp;t=OH%20MY%20GOD%20On%20pouvait%20faire%20comme%20%C3%A7a%20%21%3F" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/myspace.png" class="sociable-img sociable-hovers" title="MySpace" alt="MySpace" /></a><a rel="nofollow" target="_blank"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Ftrollfactory.fr%2Foh-my-god-on-pouvait-faire-comme-ca-515&amp;title=OH%20MY%20GOD%20On%20pouvait%20faire%20comme%20%C3%A7a%20%21%3F" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/stumbleupon.png" class="sociable-img sociable-hovers" title="StumbleUpon" alt="StumbleUpon" /></a><a rel="nofollow" target="_blank"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Ftrollfactory.fr%2Foh-my-god-on-pouvait-faire-comme-ca-515&amp;submitHeadline=OH%20MY%20GOD%20On%20pouvait%20faire%20comme%20%C3%A7a%20%21%3F&amp;submitSummary=%28pour%20Google%20quand%20m%C3%AAme%20%3A%20R%C3%A9cup%C3%A9rer%20le%20X%C3%A8me%20caract%C3%A8re%20d%27une%20string%20%2F%20cha%C3%AEne%20de%20caract%C3%A8re%20en%20PHP%20%29%0D%0APutain%20de%20programmeurs%20Perl%2C%20pourquoi%20ils%20savent%20faire%20des%20trucs%20en%20PHP%20que%20les%20programmeurs%20PHP%20savent%20pas%20faire%20%3F%0D%0A%0D%0ADepuis%20le%20temps%20que%20je%20gr&amp;submitCategory=science&amp;submitAssetType=text" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/yahoobuzz.png" class="sociable-img sociable-hovers" title="Yahoo! Buzz" alt="Yahoo! Buzz" /></a><br/><br/>]]></content:encoded>
			<wfw:commentRss>http://trollfactory.fr/oh-my-god-on-pouvait-faire-comme-ca-515/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Utiliser buildconf avec la version autoconf de son choix // Use buildconf with a specific autoconf version</title>
		<link>http://trollfactory.fr/utiliser-buildconf-avec-la-version-autoconf-de-son-choix-use-buildconf-with-a-specific-autoconf-version-314</link>
		<comments>http://trollfactory.fr/utiliser-buildconf-avec-la-version-autoconf-de-son-choix-use-buildconf-with-a-specific-autoconf-version-314#comments</comments>
		<pubDate>Sat, 27 Nov 2010 12:35:09 +0000</pubDate>
		<dc:creator><![CDATA[Troll]]></dc:creator>
				<category><![CDATA[Administration serveur]]></category>
		<category><![CDATA[astuces]]></category>
		<category><![CDATA[Geekeries]]></category>
		<category><![CDATA[Scripts, astuces, dév. web]]></category>
		<category><![CDATA[2.13]]></category>
		<category><![CDATA[autoconf]]></category>
		<category><![CDATA[buildconf]]></category>
		<category><![CDATA[compilation]]></category>
		<category><![CDATA[console]]></category>
		<category><![CDATA[gnu]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[specific version]]></category>
		<category><![CDATA[version]]></category>
		<category><![CDATA[version donnée de autoconf]]></category>

		<guid isPermaLink="false">http://trollfactory.fr/?p=314</guid>
		<description><![CDATA[As usual, for international readers, the english version is below, at the end of the French version Alors, on va encore m&#8217;accuser de publier que des billets geeks, et court pour celui-ci en plus, mais c&#8217;est tellement galère à chercher sur le net, que je ne peux m&#8217;empêcher de partager cette astuce avec vous Passons [...]]]></description>
				<content:encoded><![CDATA[<p><em><strong>As usual, for international readers, the english version is below, at the end of the French version <img src="//trollfactory.fr/wp-includes/images/smilies/icon_wink.gif" alt=";-)" class="wp-smiley" /></strong></em></p>
<p>Alors, on va encore m&rsquo;accuser de publier que des billets geeks, et court pour celui-ci en plus, mais c&rsquo;est tellement galère à chercher sur le net, que je ne peux m&rsquo;empêcher de partager cette astuce avec vous <img src="//trollfactory.fr/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" /></p>
<p>Passons aux choses intéressantes : Il peut être intéressant, voire indispensable (et ça vous intéressera majoritairement dans le cas où c&rsquo;est indispensable, n&rsquo;est-ce pas <img src="//trollfactory.fr/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" /> ) de pouvoir utiliser une vieille version de autoconf, notamment la fameuse 2.13, à la place votre super version hyper à jour utilisée par votre système GNU/Linux. Cependant, la question toute bête : bordel comment on fait pour dire à buildconf d&rsquo;utiliser une autre version que celle par défaut du système ?</p>
<p>Eh bien, si vous avez passé une heure à chercher sur internet avant d&rsquo;atterrir ici, vous allez être peut-être un peu déçu par la simplicité de la chose, mais bon, on n&rsquo;échappe pas aux lois de Murphy ! :</p>
<p><code>export PHP_AUTOCONF=`which autoconf-2.13`</code></p>
<p><em>Note : ceci est l&rsquo;exemple pour la compilation de PHP, pour la compilation d&rsquo;un autre programme cela ressemblera très certainement à cela, je ne peux cependant pas donner de généralité !</em></p>
<p><strong>Voilà c&rsquo;est fini</strong>. Il suffit de taper cela dans votre console juste avant d&rsquo;exécuter la commande &laquo;&nbsp;./builconf&nbsp;&raquo; (ou généralement &laquo;&nbsp;./buildconf &#8211;force&nbsp;&raquo; mais peu importe). <strong><span style="color: #ff0000;">Attention, cependant, vous devez taper cette commande et celle du buildconf dans la même console, évidemment.</span></strong></p>
<p>J&rsquo;espère que vous vous sentez soulagés <img src="//trollfactory.fr/wp-includes/images/smilies/icon_wink.gif" alt=";-)" class="wp-smiley" /> Notamment si vous étiez en train d&rsquo;essayer d&rsquo;installer&#8230;humm&#8230; php depuis les sources ? <img src="//trollfactory.fr/wp-includes/images/smilies/icon_wink.gif" alt=";-)" class="wp-smiley" /></p>
<p>Merci à <a href="http://blog.mageekbox.net/?post/2010/10/11/Comment-utiliser-l-autoconf-de-son-choix-pour-compiler-PHP" target="_blank">MaGeekGuy</a> pour l&rsquo;astuce <img src="//trollfactory.fr/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" /></p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<span id="more-314"></span></p>
<p>Well, I&rsquo;m going to be again accused to publish only geek articles, and moreover, short, for this one, but it&rsquo;s such a real pain to find that on the Internet, then I can&rsquo;t resist to share it with you folks <img src="//trollfactory.fr/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" /></p>
<p>Interesting things now : It can be useful, not to say essential (and it will interest you more in the case it&rsquo;s essential, won&rsquo;t it <img src="//trollfactory.fr/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" /> ) to be able to use an old version of autoconf, for exemple the famous 2.13, instead of your state-of-the-heart version used by default by your GNU/Linux operating system. However, what a stupid question : how the hell do you explain to buildconf that it must use an older version instead of the default one ?</p>
<p>Well, if you&rsquo;ve just spent about an hour searching on the Internet before coming here, you may be a bit disapointed by the simplicity of the solution. But, after all, no one escape from Murphy&rsquo;s laws ! :</p>
<p><code>export PHP_AUTOCONF=`which autoconf-2.13`</code></p>
<p><em>NB : this is an example for PHP compilation, for other soft compilation it will certainly be much like that, but I can&rsquo;t exhibate a general case here.</em></p>
<p><strong>Voilà, it&rsquo;s over !</strong> You now only need to type that in your shell just before the &laquo;&nbsp;./buildconf&nbsp;&raquo; command (or more often &laquo;&nbsp;./buildconf &#8211;force&nbsp;&raquo; but it doesn&rsquo;t really matter). <strong><span style="color: #ff0000;">Beware, however, you must type this command in the same shell as the buildconf one, obviously.</span></strong></p>
<p>I hope you feel distressed <img src="//trollfactory.fr/wp-includes/images/smilies/icon_wink.gif" alt=";-)" class="wp-smiley" /> Specifically if you were trying to install&#8230;well&#8230; php from the sources ? <img src="//trollfactory.fr/wp-includes/images/smilies/icon_wink.gif" alt=";-)" class="wp-smiley" /></p>
<p>Thanks to <a href="http://blog.mageekbox.net/?post/2010/10/11/Comment-utiliser-l-autoconf-de-son-choix-pour-compiler-PHP" target="_blank">MaGeekGuy</a> for this tip <img src="//trollfactory.fr/wp-includes/images/smilies/icon_smile.gif" alt=":-)" class="wp-smiley" /> .</p>
Share and Enjoy:<a rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Ftrollfactory.fr%2Futiliser-buildconf-avec-la-version-autoconf-de-son-choix-use-buildconf-with-a-specific-autoconf-version-314" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/printfriendly.png" class="sociable-img sociable-hovers" title="Print" alt="Print" /></a><a rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Ftrollfactory.fr%2Futiliser-buildconf-avec-la-version-autoconf-de-son-choix-use-buildconf-with-a-specific-autoconf-version-314" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/pdf.png" class="sociable-img sociable-hovers" title="PDF" alt="PDF" /></a><a rel="nofollow" target="_blank"  href="http://twitter.com/home?status=Utiliser%20buildconf%20avec%20la%20version%20autoconf%20de%20son%20choix%20%2F%2F%20Use%20buildconf%20with%20a%20specific%20autoconf%20version%20-%20http%3A%2F%2Ftrollfactory.fr%2Futiliser-buildconf-avec-la-version-autoconf-de-son-choix-use-buildconf-with-a-specific-autoconf-version-314" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/twitter.png" class="sociable-img sociable-hovers" title="Twitter" alt="Twitter" /></a><a rel="nofollow" target="_blank"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Ftrollfactory.fr%2Futiliser-buildconf-avec-la-version-autoconf-de-son-choix-use-buildconf-with-a-specific-autoconf-version-314&amp;t=Utiliser%20buildconf%20avec%20la%20version%20autoconf%20de%20son%20choix%20%2F%2F%20Use%20buildconf%20with%20a%20specific%20autoconf%20version" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/facebook.png" class="sociable-img sociable-hovers" title="Facebook" alt="Facebook" /></a><a rel="nofollow" target="_blank"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Ftrollfactory.fr%2Futiliser-buildconf-avec-la-version-autoconf-de-son-choix-use-buildconf-with-a-specific-autoconf-version-314&amp;title=Utiliser%20buildconf%20avec%20la%20version%20autoconf%20de%20son%20choix%20%2F%2F%20Use%20buildconf%20with%20a%20specific%20autoconf%20version&amp;source=The+Troll%26%23039%3Bs+factory+Geekeries+%26amp%3B+pens%C3%A9es&amp;summary=As%20usual%2C%20for%20international%20readers%2C%20the%20english%20version%20is%20below%2C%20at%20the%20end%20of%20the%20French%20version%20%3B-%29%0D%0A%0D%0AAlors%2C%20on%20va%20encore%20m%27accuser%20de%20publier%20que%20des%20billets%20geeks%2C%20et%20court%20pour%20celui-ci%20en%20plus%2C%20mais%20c%27est%20tellement%20gal%C3%A8re%20%C3%A0%20chercher%20sur%20le" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/linkedin.png" class="sociable-img sociable-hovers" title="LinkedIn" alt="LinkedIn" /></a><a rel="nofollow" target="_blank"  href="http://trollfactory.fr/feed" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/rss.png" class="sociable-img sociable-hovers" title="RSS" alt="RSS" /></a><a rel="nofollow" target="_blank"  href="http://www.wikio.fr/vote?url=http%3A%2F%2Ftrollfactory.fr%2Futiliser-buildconf-avec-la-version-autoconf-de-son-choix-use-buildconf-with-a-specific-autoconf-version-314" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/wikio.png" class="sociable-img sociable-hovers" title="Wikio FR" alt="Wikio FR" /></a><a rel="nofollow" target="_blank"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Ftrollfactory.fr%2Futiliser-buildconf-avec-la-version-autoconf-de-son-choix-use-buildconf-with-a-specific-autoconf-version-314&amp;title=Utiliser%20buildconf%20avec%20la%20version%20autoconf%20de%20son%20choix%20%2F%2F%20Use%20buildconf%20with%20a%20specific%20autoconf%20version&amp;bodytext=As%20usual%2C%20for%20international%20readers%2C%20the%20english%20version%20is%20below%2C%20at%20the%20end%20of%20the%20French%20version%20%3B-%29%0D%0A%0D%0AAlors%2C%20on%20va%20encore%20m%27accuser%20de%20publier%20que%20des%20billets%20geeks%2C%20et%20court%20pour%20celui-ci%20en%20plus%2C%20mais%20c%27est%20tellement%20gal%C3%A8re%20%C3%A0%20chercher%20sur%20le" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/digg.png" class="sociable-img sociable-hovers" title="Digg" alt="Digg" /></a><a rel="nofollow" target="_blank"  href="http://delicious.com/post?url=http%3A%2F%2Ftrollfactory.fr%2Futiliser-buildconf-avec-la-version-autoconf-de-son-choix-use-buildconf-with-a-specific-autoconf-version-314&amp;title=Utiliser%20buildconf%20avec%20la%20version%20autoconf%20de%20son%20choix%20%2F%2F%20Use%20buildconf%20with%20a%20specific%20autoconf%20version&amp;notes=As%20usual%2C%20for%20international%20readers%2C%20the%20english%20version%20is%20below%2C%20at%20the%20end%20of%20the%20French%20version%20%3B-%29%0D%0A%0D%0AAlors%2C%20on%20va%20encore%20m%27accuser%20de%20publier%20que%20des%20billets%20geeks%2C%20et%20court%20pour%20celui-ci%20en%20plus%2C%20mais%20c%27est%20tellement%20gal%C3%A8re%20%C3%A0%20chercher%20sur%20le" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/delicious.png" class="sociable-img sociable-hovers" title="del.icio.us" alt="del.icio.us" /></a><a rel="nofollow" target="_blank"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Ftrollfactory.fr%2Futiliser-buildconf-avec-la-version-autoconf-de-son-choix-use-buildconf-with-a-specific-autoconf-version-314&amp;title=Utiliser%20buildconf%20avec%20la%20version%20autoconf%20de%20son%20choix%20%2F%2F%20Use%20buildconf%20with%20a%20specific%20autoconf%20version&amp;annotation=As%20usual%2C%20for%20international%20readers%2C%20the%20english%20version%20is%20below%2C%20at%20the%20end%20of%20the%20French%20version%20%3B-%29%0D%0A%0D%0AAlors%2C%20on%20va%20encore%20m%27accuser%20de%20publier%20que%20des%20billets%20geeks%2C%20et%20court%20pour%20celui-ci%20en%20plus%2C%20mais%20c%27est%20tellement%20gal%C3%A8re%20%C3%A0%20chercher%20sur%20le" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/googlebookmark.png" class="sociable-img sociable-hovers" title="Google Bookmarks" alt="Google Bookmarks" /></a><a rel="nofollow" target="_blank"  href="http://technorati.com/faves?add=http%3A%2F%2Ftrollfactory.fr%2Futiliser-buildconf-avec-la-version-autoconf-de-son-choix-use-buildconf-with-a-specific-autoconf-version-314" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/technorati.png" class="sociable-img sociable-hovers" title="Technorati" alt="Technorati" /></a><a rel="nofollow" target="_blank"  href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Ftrollfactory.fr%2Futiliser-buildconf-avec-la-version-autoconf-de-son-choix-use-buildconf-with-a-specific-autoconf-version-314" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/sphinn.png" class="sociable-img sociable-hovers" title="Sphinn" alt="Sphinn" /></a><a rel="nofollow" target="_blank"  href="http://www.mixx.com/submit?page_url=http%3A%2F%2Ftrollfactory.fr%2Futiliser-buildconf-avec-la-version-autoconf-de-son-choix-use-buildconf-with-a-specific-autoconf-version-314&amp;title=Utiliser%20buildconf%20avec%20la%20version%20autoconf%20de%20son%20choix%20%2F%2F%20Use%20buildconf%20with%20a%20specific%20autoconf%20version" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/mixx.png" class="sociable-img sociable-hovers" title="Mixx" alt="Mixx" /></a><a rel="nofollow" target="_blank" title="Add to favorites" href="#" onclick="AddToFavorites(); return false;"><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/addtofavorites.png" class="sociable-img sociable-hovers" title="Add to favorites" alt="Add to favorites" /></a><a rel="nofollow" target="_blank"  href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Ftrollfactory.fr%2Futiliser-buildconf-avec-la-version-autoconf-de-son-choix-use-buildconf-with-a-specific-autoconf-version-314&amp;title=Utiliser%20buildconf%20avec%20la%20version%20autoconf%20de%20son%20choix%20%2F%2F%20Use%20buildconf%20with%20a%20specific%20autoconf%20version" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/live.png" class="sociable-img sociable-hovers" title="Live" alt="Live" /></a><a rel="nofollow" target="_blank"  href="http://www.netvibes.com/share?title=Utiliser%20buildconf%20avec%20la%20version%20autoconf%20de%20son%20choix%20%2F%2F%20Use%20buildconf%20with%20a%20specific%20autoconf%20version&amp;url=http%3A%2F%2Ftrollfactory.fr%2Futiliser-buildconf-avec-la-version-autoconf-de-son-choix-use-buildconf-with-a-specific-autoconf-version-314" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/netvibes.png" class="sociable-img sociable-hovers" title="Netvibes" alt="Netvibes" /></a><a rel="nofollow" target="_blank"  href="http://www.scoopeo.com/scoop/new?newurl=http%3A%2F%2Ftrollfactory.fr%2Futiliser-buildconf-avec-la-version-autoconf-de-son-choix-use-buildconf-with-a-specific-autoconf-version-314&amp;title=Utiliser%20buildconf%20avec%20la%20version%20autoconf%20de%20son%20choix%20%2F%2F%20Use%20buildconf%20with%20a%20specific%20autoconf%20version" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/scoopeo.png" class="sociable-img sociable-hovers" title="Scoopeo" alt="Scoopeo" /></a><a rel="nofollow" target="_blank"  href="http://www.viadeo.com/shareit/share/?url=http%3A%2F%2Ftrollfactory.fr%2Futiliser-buildconf-avec-la-version-autoconf-de-son-choix-use-buildconf-with-a-specific-autoconf-version-314&title=Utiliser%20buildconf%20avec%20la%20version%20autoconf%20de%20son%20choix%20%2F%2F%20Use%20buildconf%20with%20a%20specific%20autoconf%20version&urllanguage=fr" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/viadeo.png" class="sociable-img sociable-hovers" title="viadeo FR" alt="viadeo FR" /></a><a rel="nofollow" target="_blank"  href="http://identi.ca/notice/new?status_textarea=http%3A%2F%2Ftrollfactory.fr%2Futiliser-buildconf-avec-la-version-autoconf-de-son-choix-use-buildconf-with-a-specific-autoconf-version-314" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/identica.png" class="sociable-img sociable-hovers" title="Identi.ca" alt="Identi.ca" /></a><a rel="nofollow" target="_blank"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Ftrollfactory.fr%2Futiliser-buildconf-avec-la-version-autoconf-de-son-choix-use-buildconf-with-a-specific-autoconf-version-314&amp;t=Utiliser%20buildconf%20avec%20la%20version%20autoconf%20de%20son%20choix%20%2F%2F%20Use%20buildconf%20with%20a%20specific%20autoconf%20version" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/myspace.png" class="sociable-img sociable-hovers" title="MySpace" alt="MySpace" /></a><a rel="nofollow" target="_blank"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Ftrollfactory.fr%2Futiliser-buildconf-avec-la-version-autoconf-de-son-choix-use-buildconf-with-a-specific-autoconf-version-314&amp;title=Utiliser%20buildconf%20avec%20la%20version%20autoconf%20de%20son%20choix%20%2F%2F%20Use%20buildconf%20with%20a%20specific%20autoconf%20version" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/stumbleupon.png" class="sociable-img sociable-hovers" title="StumbleUpon" alt="StumbleUpon" /></a><a rel="nofollow" target="_blank"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Ftrollfactory.fr%2Futiliser-buildconf-avec-la-version-autoconf-de-son-choix-use-buildconf-with-a-specific-autoconf-version-314&amp;submitHeadline=Utiliser%20buildconf%20avec%20la%20version%20autoconf%20de%20son%20choix%20%2F%2F%20Use%20buildconf%20with%20a%20specific%20autoconf%20version&amp;submitSummary=As%20usual%2C%20for%20international%20readers%2C%20the%20english%20version%20is%20below%2C%20at%20the%20end%20of%20the%20French%20version%20%3B-%29%0D%0A%0D%0AAlors%2C%20on%20va%20encore%20m%27accuser%20de%20publier%20que%20des%20billets%20geeks%2C%20et%20court%20pour%20celui-ci%20en%20plus%2C%20mais%20c%27est%20tellement%20gal%C3%A8re%20%C3%A0%20chercher%20sur%20le&amp;submitCategory=science&amp;submitAssetType=text" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/yahoobuzz.png" class="sociable-img sociable-hovers" title="Yahoo! Buzz" alt="Yahoo! Buzz" /></a><br/><br/>]]></content:encoded>
			<wfw:commentRss>http://trollfactory.fr/utiliser-buildconf-avec-la-version-autoconf-de-son-choix-use-buildconf-with-a-specific-autoconf-version-314/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[PHP] Effectuer un is_file() ou file_exists() sur un fichier distant (HTTP)</title>
		<link>http://trollfactory.fr/php-effectuer-un-is_file-ou-file_exists-sur-un-fichier-distant-http-178</link>
		<comments>http://trollfactory.fr/php-effectuer-un-is_file-ou-file_exists-sur-un-fichier-distant-http-178#comments</comments>
		<pubDate>Thu, 18 Feb 2010 06:45:07 +0000</pubDate>
		<dc:creator><![CDATA[Troll]]></dc:creator>
				<category><![CDATA[Scripts, astuces, dév. web]]></category>
		<category><![CDATA[distant]]></category>
		<category><![CDATA[file_exists]]></category>
		<category><![CDATA[file_get_contents]]></category>
		<category><![CDATA[fopen]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[is_file]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[source]]></category>

		<guid isPermaLink="false">http://trollfactory.fr/?p=178</guid>
		<description><![CDATA[Dans la lignée de la précédente astuce sur les fichiers distants en voici une autre, plus courte, mais qui pourrait bien en dépanner plus d&#8217;un. En effet la fonction is_file() ou encore la fonction file_exists() sont des fonctions faites pour fonctionner sur le système de fichier local. Et elles ne fonctionneront donc pas si vous [...]]]></description>
				<content:encoded><![CDATA[<p>Dans la lignée de <a href="http://trollfactory.fr/php-date-de-derniere-modification-dun-fichier-distant-en-http-165">la précédente astuce sur les fichiers distants</a> en voici une autre, plus courte, mais qui pourrait bien en dépanner plus d&rsquo;un. En effet la fonction <strong>is_file()</strong> ou encore la fonction <strong>file_exists()</strong> sont des fonctions faites pour fonctionner sur le système de fichier local. Et elles ne fonctionneront donc pas si vous cherchez à savoir si le fichier &laquo;&nbsp;http://web.com/fichier.blabla&nbsp;&raquo; existe ou pas.</p>
<p>L&rsquo;astuce est toute simple, elle consiste à tenter d&rsquo;ouvrir le fichier, avec une fonction qui elle, prend en charge le HTTP :</p>
<pre>function FichierDistantExiste($url) {
   if(!@fopen($url, 'r')) return false;
   else return true;
}</pre>
<p>Ce fut bref, mais j&rsquo;espère que cela vous sera utile <img src="//trollfactory.fr/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" /></p>
<p>Attention par contre, sauf erreur de ma part certaines configurations PHP (notamment sur des mutualisés évidemment, mais pas tous hein) empêchent fopen() d&rsquo;utiliser le HTTP. Dans ce cas, on serait bien tenté d&rsquo;utiliser la fonction file_get_contents() sauf qu&rsquo;en fait ce n&rsquo;est qu&rsquo;une espèce de raccourci pour les fonction fopen(), fgets() et fclose() les un après les autres. Donc si l&rsquo;un est bridé l&rsquo;autre devrait l&rsquo;être aussi. À vous de tester, on ne sait jamais.</p>
Share and Enjoy:<a rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Ftrollfactory.fr%2Fphp-effectuer-un-is_file-ou-file_exists-sur-un-fichier-distant-http-178" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/printfriendly.png" class="sociable-img sociable-hovers" title="Print" alt="Print" /></a><a rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Ftrollfactory.fr%2Fphp-effectuer-un-is_file-ou-file_exists-sur-un-fichier-distant-http-178" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/pdf.png" class="sociable-img sociable-hovers" title="PDF" alt="PDF" /></a><a rel="nofollow" target="_blank"  href="http://twitter.com/home?status=%5BPHP%5D%20Effectuer%20un%20is_file%28%29%20ou%20file_exists%28%29%20sur%20un%20fichier%20distant%20%28HTTP%29%20-%20http%3A%2F%2Ftrollfactory.fr%2Fphp-effectuer-un-is_file-ou-file_exists-sur-un-fichier-distant-http-178" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/twitter.png" class="sociable-img sociable-hovers" title="Twitter" alt="Twitter" /></a><a rel="nofollow" target="_blank"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Ftrollfactory.fr%2Fphp-effectuer-un-is_file-ou-file_exists-sur-un-fichier-distant-http-178&amp;t=%5BPHP%5D%20Effectuer%20un%20is_file%28%29%20ou%20file_exists%28%29%20sur%20un%20fichier%20distant%20%28HTTP%29" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/facebook.png" class="sociable-img sociable-hovers" title="Facebook" alt="Facebook" /></a><a rel="nofollow" target="_blank"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Ftrollfactory.fr%2Fphp-effectuer-un-is_file-ou-file_exists-sur-un-fichier-distant-http-178&amp;title=%5BPHP%5D%20Effectuer%20un%20is_file%28%29%20ou%20file_exists%28%29%20sur%20un%20fichier%20distant%20%28HTTP%29&amp;source=The+Troll%26%23039%3Bs+factory+Geekeries+%26amp%3B+pens%C3%A9es&amp;summary=Dans%20la%20lign%C3%A9e%20de%20la%20pr%C3%A9c%C3%A9dente%20astuce%20sur%20les%20fichiers%20distants%20en%20voici%20une%20autre%2C%20plus%20courte%2C%20mais%20qui%20pourrait%20bien%20en%20d%C3%A9panner%20plus%20d%27un.%20En%20effet%20la%20fonction%20is_file%28%29%20ou%20encore%20la%20fonction%20file_exists%28%29%20sont%20des%20fonctions%20faites%20pour%20fonc" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/linkedin.png" class="sociable-img sociable-hovers" title="LinkedIn" alt="LinkedIn" /></a><a rel="nofollow" target="_blank"  href="http://trollfactory.fr/feed" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/rss.png" class="sociable-img sociable-hovers" title="RSS" alt="RSS" /></a><a rel="nofollow" target="_blank"  href="http://www.wikio.fr/vote?url=http%3A%2F%2Ftrollfactory.fr%2Fphp-effectuer-un-is_file-ou-file_exists-sur-un-fichier-distant-http-178" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/wikio.png" class="sociable-img sociable-hovers" title="Wikio FR" alt="Wikio FR" /></a><a rel="nofollow" target="_blank"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Ftrollfactory.fr%2Fphp-effectuer-un-is_file-ou-file_exists-sur-un-fichier-distant-http-178&amp;title=%5BPHP%5D%20Effectuer%20un%20is_file%28%29%20ou%20file_exists%28%29%20sur%20un%20fichier%20distant%20%28HTTP%29&amp;bodytext=Dans%20la%20lign%C3%A9e%20de%20la%20pr%C3%A9c%C3%A9dente%20astuce%20sur%20les%20fichiers%20distants%20en%20voici%20une%20autre%2C%20plus%20courte%2C%20mais%20qui%20pourrait%20bien%20en%20d%C3%A9panner%20plus%20d%27un.%20En%20effet%20la%20fonction%20is_file%28%29%20ou%20encore%20la%20fonction%20file_exists%28%29%20sont%20des%20fonctions%20faites%20pour%20fonc" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/digg.png" class="sociable-img sociable-hovers" title="Digg" alt="Digg" /></a><a rel="nofollow" target="_blank"  href="http://delicious.com/post?url=http%3A%2F%2Ftrollfactory.fr%2Fphp-effectuer-un-is_file-ou-file_exists-sur-un-fichier-distant-http-178&amp;title=%5BPHP%5D%20Effectuer%20un%20is_file%28%29%20ou%20file_exists%28%29%20sur%20un%20fichier%20distant%20%28HTTP%29&amp;notes=Dans%20la%20lign%C3%A9e%20de%20la%20pr%C3%A9c%C3%A9dente%20astuce%20sur%20les%20fichiers%20distants%20en%20voici%20une%20autre%2C%20plus%20courte%2C%20mais%20qui%20pourrait%20bien%20en%20d%C3%A9panner%20plus%20d%27un.%20En%20effet%20la%20fonction%20is_file%28%29%20ou%20encore%20la%20fonction%20file_exists%28%29%20sont%20des%20fonctions%20faites%20pour%20fonc" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/delicious.png" class="sociable-img sociable-hovers" title="del.icio.us" alt="del.icio.us" /></a><a rel="nofollow" target="_blank"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Ftrollfactory.fr%2Fphp-effectuer-un-is_file-ou-file_exists-sur-un-fichier-distant-http-178&amp;title=%5BPHP%5D%20Effectuer%20un%20is_file%28%29%20ou%20file_exists%28%29%20sur%20un%20fichier%20distant%20%28HTTP%29&amp;annotation=Dans%20la%20lign%C3%A9e%20de%20la%20pr%C3%A9c%C3%A9dente%20astuce%20sur%20les%20fichiers%20distants%20en%20voici%20une%20autre%2C%20plus%20courte%2C%20mais%20qui%20pourrait%20bien%20en%20d%C3%A9panner%20plus%20d%27un.%20En%20effet%20la%20fonction%20is_file%28%29%20ou%20encore%20la%20fonction%20file_exists%28%29%20sont%20des%20fonctions%20faites%20pour%20fonc" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/googlebookmark.png" class="sociable-img sociable-hovers" title="Google Bookmarks" alt="Google Bookmarks" /></a><a rel="nofollow" target="_blank"  href="http://technorati.com/faves?add=http%3A%2F%2Ftrollfactory.fr%2Fphp-effectuer-un-is_file-ou-file_exists-sur-un-fichier-distant-http-178" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/technorati.png" class="sociable-img sociable-hovers" title="Technorati" alt="Technorati" /></a><a rel="nofollow" target="_blank"  href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Ftrollfactory.fr%2Fphp-effectuer-un-is_file-ou-file_exists-sur-un-fichier-distant-http-178" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/sphinn.png" class="sociable-img sociable-hovers" title="Sphinn" alt="Sphinn" /></a><a rel="nofollow" target="_blank"  href="http://www.mixx.com/submit?page_url=http%3A%2F%2Ftrollfactory.fr%2Fphp-effectuer-un-is_file-ou-file_exists-sur-un-fichier-distant-http-178&amp;title=%5BPHP%5D%20Effectuer%20un%20is_file%28%29%20ou%20file_exists%28%29%20sur%20un%20fichier%20distant%20%28HTTP%29" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/mixx.png" class="sociable-img sociable-hovers" title="Mixx" alt="Mixx" /></a><a rel="nofollow" target="_blank" title="Add to favorites" href="#" onclick="AddToFavorites(); return false;"><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/addtofavorites.png" class="sociable-img sociable-hovers" title="Add to favorites" alt="Add to favorites" /></a><a rel="nofollow" target="_blank"  href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Ftrollfactory.fr%2Fphp-effectuer-un-is_file-ou-file_exists-sur-un-fichier-distant-http-178&amp;title=%5BPHP%5D%20Effectuer%20un%20is_file%28%29%20ou%20file_exists%28%29%20sur%20un%20fichier%20distant%20%28HTTP%29" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/live.png" class="sociable-img sociable-hovers" title="Live" alt="Live" /></a><a rel="nofollow" target="_blank"  href="http://www.netvibes.com/share?title=%5BPHP%5D%20Effectuer%20un%20is_file%28%29%20ou%20file_exists%28%29%20sur%20un%20fichier%20distant%20%28HTTP%29&amp;url=http%3A%2F%2Ftrollfactory.fr%2Fphp-effectuer-un-is_file-ou-file_exists-sur-un-fichier-distant-http-178" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/netvibes.png" class="sociable-img sociable-hovers" title="Netvibes" alt="Netvibes" /></a><a rel="nofollow" target="_blank"  href="http://www.scoopeo.com/scoop/new?newurl=http%3A%2F%2Ftrollfactory.fr%2Fphp-effectuer-un-is_file-ou-file_exists-sur-un-fichier-distant-http-178&amp;title=%5BPHP%5D%20Effectuer%20un%20is_file%28%29%20ou%20file_exists%28%29%20sur%20un%20fichier%20distant%20%28HTTP%29" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/scoopeo.png" class="sociable-img sociable-hovers" title="Scoopeo" alt="Scoopeo" /></a><a rel="nofollow" target="_blank"  href="http://www.viadeo.com/shareit/share/?url=http%3A%2F%2Ftrollfactory.fr%2Fphp-effectuer-un-is_file-ou-file_exists-sur-un-fichier-distant-http-178&title=%5BPHP%5D%20Effectuer%20un%20is_file%28%29%20ou%20file_exists%28%29%20sur%20un%20fichier%20distant%20%28HTTP%29&urllanguage=fr" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/viadeo.png" class="sociable-img sociable-hovers" title="viadeo FR" alt="viadeo FR" /></a><a rel="nofollow" target="_blank"  href="http://identi.ca/notice/new?status_textarea=http%3A%2F%2Ftrollfactory.fr%2Fphp-effectuer-un-is_file-ou-file_exists-sur-un-fichier-distant-http-178" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/identica.png" class="sociable-img sociable-hovers" title="Identi.ca" alt="Identi.ca" /></a><a rel="nofollow" target="_blank"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Ftrollfactory.fr%2Fphp-effectuer-un-is_file-ou-file_exists-sur-un-fichier-distant-http-178&amp;t=%5BPHP%5D%20Effectuer%20un%20is_file%28%29%20ou%20file_exists%28%29%20sur%20un%20fichier%20distant%20%28HTTP%29" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/myspace.png" class="sociable-img sociable-hovers" title="MySpace" alt="MySpace" /></a><a rel="nofollow" target="_blank"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Ftrollfactory.fr%2Fphp-effectuer-un-is_file-ou-file_exists-sur-un-fichier-distant-http-178&amp;title=%5BPHP%5D%20Effectuer%20un%20is_file%28%29%20ou%20file_exists%28%29%20sur%20un%20fichier%20distant%20%28HTTP%29" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/stumbleupon.png" class="sociable-img sociable-hovers" title="StumbleUpon" alt="StumbleUpon" /></a><a rel="nofollow" target="_blank"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Ftrollfactory.fr%2Fphp-effectuer-un-is_file-ou-file_exists-sur-un-fichier-distant-http-178&amp;submitHeadline=%5BPHP%5D%20Effectuer%20un%20is_file%28%29%20ou%20file_exists%28%29%20sur%20un%20fichier%20distant%20%28HTTP%29&amp;submitSummary=Dans%20la%20lign%C3%A9e%20de%20la%20pr%C3%A9c%C3%A9dente%20astuce%20sur%20les%20fichiers%20distants%20en%20voici%20une%20autre%2C%20plus%20courte%2C%20mais%20qui%20pourrait%20bien%20en%20d%C3%A9panner%20plus%20d%27un.%20En%20effet%20la%20fonction%20is_file%28%29%20ou%20encore%20la%20fonction%20file_exists%28%29%20sont%20des%20fonctions%20faites%20pour%20fonc&amp;submitCategory=science&amp;submitAssetType=text" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/yahoobuzz.png" class="sociable-img sociable-hovers" title="Yahoo! Buzz" alt="Yahoo! Buzz" /></a><br/><br/>]]></content:encoded>
			<wfw:commentRss>http://trollfactory.fr/php-effectuer-un-is_file-ou-file_exists-sur-un-fichier-distant-http-178/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>[PHP] Date de dernière modification d&#8217;un fichier distant en HTTP</title>
		<link>http://trollfactory.fr/php-date-de-derniere-modification-dun-fichier-distant-en-http-165</link>
		<comments>http://trollfactory.fr/php-date-de-derniere-modification-dun-fichier-distant-en-http-165#comments</comments>
		<pubDate>Thu, 18 Feb 2010 06:35:01 +0000</pubDate>
		<dc:creator><![CDATA[Troll]]></dc:creator>
				<category><![CDATA[Non classé]]></category>
		<category><![CDATA[Scripts, astuces, dév. web]]></category>
		<category><![CDATA[date de modification]]></category>
		<category><![CDATA[distant]]></category>
		<category><![CDATA[filemtime]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[source]]></category>

		<guid isPermaLink="false">http://trollfactory.fr/?p=165</guid>
		<description><![CDATA[Cette source n&#8217;est pas de moi, cependant comme je ne suis pas sûr que tous les gens qui cherchent comment récupérer la date de dernière modification d&#8217;un fichier en utilisant le HTTP (fichier distant) arrivent facilement à trouver ce post (en anglais en plus) je vous mets la source ici. D&#8217;ailleurs, au passage, comme je [...]]]></description>
				<content:encoded><![CDATA[<p>Cette source n&rsquo;est pas de moi, cependant comme je ne suis pas sûr que tous les gens qui cherchent <strong>comment récupérer la date de dernière modification d&rsquo;un fichier en utilisant le HTTP (fichier distant)</strong> arrivent facilement à trouver <a href="http://www.php.net/manual/en/function.filemtime.php#73747">ce post (en anglais en plus)</a> je vous mets la source ici.</p>
<p>D&rsquo;ailleurs, au passage, comme je suis un gentil Troll, je vous l&rsquo;ai traduite <img src="//trollfactory.fr/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" /></p>
<pre>
// Récupérer la date de dernière modification d'un fichier distant (la fonction retourne un timestamp unix, cf. http://wiki.pcinfo-web.com/timestamp )
function RecupDateModifDistant( $uri )
{
// default
$unixtime = 0;
$fp = fopen( $uri, "r" );
if( !$fp ) {return;}

$MetaData = stream_get_meta_data( $fp );

foreach( $MetaData['wrapper_data'] as $response )
{
// Dans le cas d'une redirection vers une autre page / un autre fichier
if( substr( strtolower($response), 0, 10 ) == 'location: ' )
{
$newUri = substr( $response, 10 );
fclose( $fp );
return RecupDateModifDistant( $newUri );
}
// Dans le cas où on a bien l'en-tête "last-modified"
elseif( substr( strtolower($response), 0, 15 ) == 'last-modified: ' )
{
$unixtime = strtotime( substr($response, 15) );
break;
}
}
fclose( $fp );
return $unixtime;
}
</pre>
<p>Voilà, pour toute demande d&rsquo;explication du code, les commentaires sont là pour ça, ils vous attendent pour vous faire des calins ! (gratuit !)</p>
Share and Enjoy:<a rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Ftrollfactory.fr%2Fphp-date-de-derniere-modification-dun-fichier-distant-en-http-165" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/printfriendly.png" class="sociable-img sociable-hovers" title="Print" alt="Print" /></a><a rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Ftrollfactory.fr%2Fphp-date-de-derniere-modification-dun-fichier-distant-en-http-165" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/pdf.png" class="sociable-img sociable-hovers" title="PDF" alt="PDF" /></a><a rel="nofollow" target="_blank"  href="http://twitter.com/home?status=%5BPHP%5D%20Date%20de%20derni%C3%A8re%20modification%20d%27un%20fichier%20distant%20en%20HTTP%20-%20http%3A%2F%2Ftrollfactory.fr%2Fphp-date-de-derniere-modification-dun-fichier-distant-en-http-165" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/twitter.png" class="sociable-img sociable-hovers" title="Twitter" alt="Twitter" /></a><a rel="nofollow" target="_blank"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Ftrollfactory.fr%2Fphp-date-de-derniere-modification-dun-fichier-distant-en-http-165&amp;t=%5BPHP%5D%20Date%20de%20derni%C3%A8re%20modification%20d%27un%20fichier%20distant%20en%20HTTP" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/facebook.png" class="sociable-img sociable-hovers" title="Facebook" alt="Facebook" /></a><a rel="nofollow" target="_blank"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Ftrollfactory.fr%2Fphp-date-de-derniere-modification-dun-fichier-distant-en-http-165&amp;title=%5BPHP%5D%20Date%20de%20derni%C3%A8re%20modification%20d%27un%20fichier%20distant%20en%20HTTP&amp;source=The+Troll%26%23039%3Bs+factory+Geekeries+%26amp%3B+pens%C3%A9es&amp;summary=Cette%20source%20n%27est%20pas%20de%20moi%2C%20cependant%20comme%20je%20ne%20suis%20pas%20s%C3%BBr%20que%20tous%20les%20gens%20qui%20cherchent%20comment%20r%C3%A9cup%C3%A9rer%20la%20date%20de%20derni%C3%A8re%20modification%20d%27un%20fichier%20en%20utilisant%20le%20HTTP%20%28fichier%20distant%29%20arrivent%20facilement%20%C3%A0%20trouver%20ce%20post%20%28en%20an" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/linkedin.png" class="sociable-img sociable-hovers" title="LinkedIn" alt="LinkedIn" /></a><a rel="nofollow" target="_blank"  href="http://trollfactory.fr/feed" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/rss.png" class="sociable-img sociable-hovers" title="RSS" alt="RSS" /></a><a rel="nofollow" target="_blank"  href="http://www.wikio.fr/vote?url=http%3A%2F%2Ftrollfactory.fr%2Fphp-date-de-derniere-modification-dun-fichier-distant-en-http-165" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/wikio.png" class="sociable-img sociable-hovers" title="Wikio FR" alt="Wikio FR" /></a><a rel="nofollow" target="_blank"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Ftrollfactory.fr%2Fphp-date-de-derniere-modification-dun-fichier-distant-en-http-165&amp;title=%5BPHP%5D%20Date%20de%20derni%C3%A8re%20modification%20d%27un%20fichier%20distant%20en%20HTTP&amp;bodytext=Cette%20source%20n%27est%20pas%20de%20moi%2C%20cependant%20comme%20je%20ne%20suis%20pas%20s%C3%BBr%20que%20tous%20les%20gens%20qui%20cherchent%20comment%20r%C3%A9cup%C3%A9rer%20la%20date%20de%20derni%C3%A8re%20modification%20d%27un%20fichier%20en%20utilisant%20le%20HTTP%20%28fichier%20distant%29%20arrivent%20facilement%20%C3%A0%20trouver%20ce%20post%20%28en%20an" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/digg.png" class="sociable-img sociable-hovers" title="Digg" alt="Digg" /></a><a rel="nofollow" target="_blank"  href="http://delicious.com/post?url=http%3A%2F%2Ftrollfactory.fr%2Fphp-date-de-derniere-modification-dun-fichier-distant-en-http-165&amp;title=%5BPHP%5D%20Date%20de%20derni%C3%A8re%20modification%20d%27un%20fichier%20distant%20en%20HTTP&amp;notes=Cette%20source%20n%27est%20pas%20de%20moi%2C%20cependant%20comme%20je%20ne%20suis%20pas%20s%C3%BBr%20que%20tous%20les%20gens%20qui%20cherchent%20comment%20r%C3%A9cup%C3%A9rer%20la%20date%20de%20derni%C3%A8re%20modification%20d%27un%20fichier%20en%20utilisant%20le%20HTTP%20%28fichier%20distant%29%20arrivent%20facilement%20%C3%A0%20trouver%20ce%20post%20%28en%20an" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/delicious.png" class="sociable-img sociable-hovers" title="del.icio.us" alt="del.icio.us" /></a><a rel="nofollow" target="_blank"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Ftrollfactory.fr%2Fphp-date-de-derniere-modification-dun-fichier-distant-en-http-165&amp;title=%5BPHP%5D%20Date%20de%20derni%C3%A8re%20modification%20d%27un%20fichier%20distant%20en%20HTTP&amp;annotation=Cette%20source%20n%27est%20pas%20de%20moi%2C%20cependant%20comme%20je%20ne%20suis%20pas%20s%C3%BBr%20que%20tous%20les%20gens%20qui%20cherchent%20comment%20r%C3%A9cup%C3%A9rer%20la%20date%20de%20derni%C3%A8re%20modification%20d%27un%20fichier%20en%20utilisant%20le%20HTTP%20%28fichier%20distant%29%20arrivent%20facilement%20%C3%A0%20trouver%20ce%20post%20%28en%20an" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/googlebookmark.png" class="sociable-img sociable-hovers" title="Google Bookmarks" alt="Google Bookmarks" /></a><a rel="nofollow" target="_blank"  href="http://technorati.com/faves?add=http%3A%2F%2Ftrollfactory.fr%2Fphp-date-de-derniere-modification-dun-fichier-distant-en-http-165" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/technorati.png" class="sociable-img sociable-hovers" title="Technorati" alt="Technorati" /></a><a rel="nofollow" target="_blank"  href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Ftrollfactory.fr%2Fphp-date-de-derniere-modification-dun-fichier-distant-en-http-165" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/sphinn.png" class="sociable-img sociable-hovers" title="Sphinn" alt="Sphinn" /></a><a rel="nofollow" target="_blank"  href="http://www.mixx.com/submit?page_url=http%3A%2F%2Ftrollfactory.fr%2Fphp-date-de-derniere-modification-dun-fichier-distant-en-http-165&amp;title=%5BPHP%5D%20Date%20de%20derni%C3%A8re%20modification%20d%27un%20fichier%20distant%20en%20HTTP" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/mixx.png" class="sociable-img sociable-hovers" title="Mixx" alt="Mixx" /></a><a rel="nofollow" target="_blank" title="Add to favorites" href="#" onclick="AddToFavorites(); return false;"><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/addtofavorites.png" class="sociable-img sociable-hovers" title="Add to favorites" alt="Add to favorites" /></a><a rel="nofollow" target="_blank"  href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Ftrollfactory.fr%2Fphp-date-de-derniere-modification-dun-fichier-distant-en-http-165&amp;title=%5BPHP%5D%20Date%20de%20derni%C3%A8re%20modification%20d%27un%20fichier%20distant%20en%20HTTP" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/live.png" class="sociable-img sociable-hovers" title="Live" alt="Live" /></a><a rel="nofollow" target="_blank"  href="http://www.netvibes.com/share?title=%5BPHP%5D%20Date%20de%20derni%C3%A8re%20modification%20d%27un%20fichier%20distant%20en%20HTTP&amp;url=http%3A%2F%2Ftrollfactory.fr%2Fphp-date-de-derniere-modification-dun-fichier-distant-en-http-165" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/netvibes.png" class="sociable-img sociable-hovers" title="Netvibes" alt="Netvibes" /></a><a rel="nofollow" target="_blank"  href="http://www.scoopeo.com/scoop/new?newurl=http%3A%2F%2Ftrollfactory.fr%2Fphp-date-de-derniere-modification-dun-fichier-distant-en-http-165&amp;title=%5BPHP%5D%20Date%20de%20derni%C3%A8re%20modification%20d%27un%20fichier%20distant%20en%20HTTP" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/scoopeo.png" class="sociable-img sociable-hovers" title="Scoopeo" alt="Scoopeo" /></a><a rel="nofollow" target="_blank"  href="http://www.viadeo.com/shareit/share/?url=http%3A%2F%2Ftrollfactory.fr%2Fphp-date-de-derniere-modification-dun-fichier-distant-en-http-165&title=%5BPHP%5D%20Date%20de%20derni%C3%A8re%20modification%20d%27un%20fichier%20distant%20en%20HTTP&urllanguage=fr" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/viadeo.png" class="sociable-img sociable-hovers" title="viadeo FR" alt="viadeo FR" /></a><a rel="nofollow" target="_blank"  href="http://identi.ca/notice/new?status_textarea=http%3A%2F%2Ftrollfactory.fr%2Fphp-date-de-derniere-modification-dun-fichier-distant-en-http-165" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/identica.png" class="sociable-img sociable-hovers" title="Identi.ca" alt="Identi.ca" /></a><a rel="nofollow" target="_blank"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Ftrollfactory.fr%2Fphp-date-de-derniere-modification-dun-fichier-distant-en-http-165&amp;t=%5BPHP%5D%20Date%20de%20derni%C3%A8re%20modification%20d%27un%20fichier%20distant%20en%20HTTP" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/myspace.png" class="sociable-img sociable-hovers" title="MySpace" alt="MySpace" /></a><a rel="nofollow" target="_blank"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Ftrollfactory.fr%2Fphp-date-de-derniere-modification-dun-fichier-distant-en-http-165&amp;title=%5BPHP%5D%20Date%20de%20derni%C3%A8re%20modification%20d%27un%20fichier%20distant%20en%20HTTP" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/stumbleupon.png" class="sociable-img sociable-hovers" title="StumbleUpon" alt="StumbleUpon" /></a><a rel="nofollow" target="_blank"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Ftrollfactory.fr%2Fphp-date-de-derniere-modification-dun-fichier-distant-en-http-165&amp;submitHeadline=%5BPHP%5D%20Date%20de%20derni%C3%A8re%20modification%20d%27un%20fichier%20distant%20en%20HTTP&amp;submitSummary=Cette%20source%20n%27est%20pas%20de%20moi%2C%20cependant%20comme%20je%20ne%20suis%20pas%20s%C3%BBr%20que%20tous%20les%20gens%20qui%20cherchent%20comment%20r%C3%A9cup%C3%A9rer%20la%20date%20de%20derni%C3%A8re%20modification%20d%27un%20fichier%20en%20utilisant%20le%20HTTP%20%28fichier%20distant%29%20arrivent%20facilement%20%C3%A0%20trouver%20ce%20post%20%28en%20an&amp;submitCategory=science&amp;submitAssetType=text" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/yahoobuzz.png" class="sociable-img sociable-hovers" title="Yahoo! Buzz" alt="Yahoo! Buzz" /></a><br/><br/>]]></content:encoded>
			<wfw:commentRss>http://trollfactory.fr/php-date-de-derniere-modification-dun-fichier-distant-en-http-165/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Du safe_mode avec DTC : danger &amp; sécurité</title>
		<link>http://trollfactory.fr/du-safe_mode-avec-dtc-danger-securite-70</link>
		<comments>http://trollfactory.fr/du-safe_mode-avec-dtc-danger-securite-70#comments</comments>
		<pubDate>Mon, 21 Dec 2009 21:29:29 +0000</pubDate>
		<dc:creator><![CDATA[Troll]]></dc:creator>
				<category><![CDATA[Scripts, astuces, dév. web]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[dtc]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[safe_mode]]></category>
		<category><![CDATA[sécurité]]></category>

		<guid isPermaLink="false">http://trollfactory.fr/?p=70</guid>
		<description><![CDATA[DTC utilise un système d'arborescence et de chroot pour gérer tous les fichiers avec un seul user tout en engiguant les scripts. Cependant, si l'on désactive le safe_mode dans PHP, alors le monde s'osbcurcie et... [lisez la suite !]]]></description>
				<content:encoded><![CDATA[<p><strong>Comme </strong><a href="http://trollfactory.fr/neige-qui-tombe-un-peu-de-gaiete-sur-votre-site-web-pour-noel-54#post"><strong>je vous le promettais hier</strong></a><strong> je vous parle aujourd&rsquo;hui des enjeux et des dangers que j&rsquo;ai découverts pour le safe_mode (ou plutôt sa désactivation) utilisé avec le panel de gestion de serveur DTC.</strong></p>
<p>Tout d&rsquo;abord, petit retour rapide sur le <strong>fonctionnement de DTC</strong> :</p>
<p><strong>DTC crée un utilisateur &laquo;&nbsp;dtc&nbsp;&raquo; et un groupe &laquo;&nbsp;dtcgrp&nbsp;&raquo; avec lesquels il fait la plupart de ce qu&rsquo;il a à faire.</strong> Ainsi le ftp est géré par l&rsquo;utilisateur DTC, les connexions en SSH également (mais justement il y a de sacrés bugs là-dessus), les connexions imap, smtp, etc&#8230; etc&#8230; et également les connexions HTTP, et donc les lancements d&rsquo;Apache2 !</p>
<p>Concrètement, DTC est fait pour gérer un serveur dédié et donc proposer divers hébergements à divers sites.</p>
<p>Il crée toute une arborescence à laquelle on adhère ou non mais qui a le mérite d&rsquo;être relativement claire et facile à utiliser et retenir.</p>
<p><strong>Tous les fichiers de tous les sites appartiennent ainsi à un seul et unique couple user/groupe : dtc/dtcgrp.</strong></p>
<p>DTC utilise énormément le principe plus ou moins bon des chroot pour lancer ses scripts de manière à les &laquo;&nbsp;endiguer&nbsp;&raquo; et qu&rsquo;ils n&rsquo;aillent pas faire n&rsquo;importe quoi, particulièrement sur les fichiers appartenant à DTC sur le serveur.</p>
<p>Cependant DTC n&rsquo;a pas prévu une chose&#8230; c&rsquo;est l&rsquo;utilisation de <strong>la commande shell_exec()</strong> de PHP (PHP 5 notamment, je ne sais pas pour le 4).</p>
<p><strong>Par défaut, le safe_mode étant activé</strong> avec PHP, la commande shell_exec est quasiment inutilisable.</p>
<p>Cependant, <strong>si par malheur vous désactiver le safe_mode</strong> sur un domaine particulier&#8230; catastrophe ! Vous venez d&rsquo;autoriser la personne qui s&rsquo;occupe du site de ce domaine, à faire n&rsquo;importe quoi sur le serveur (enfin sauf tâches d&rsquo;administration (root) ).</p>
<p>Non seulement parce-qu&rsquo;elle peut maintenant utiliser shell_exec() pour effectuer des actions au niveau de l&rsquo;utilisateur dtc, mais surtout parce-que, même si certaines commandes sont bridées, <strong>shell_exec() permet d&rsquo;utiliser la commande crontab</strong>.</p>
<p>Or, crontab permet de définir des tâches cron (je vous renvoie à Google si vous ne savez pas ce que c&rsquo;est : cron est un gestionnaire de tâches planifiées). Or, quand cron lance la tâche, qu&rsquo;elle qu&rsquo;elle soit, <strong>elle est lancée au niveau de l&rsquo;utilisateur auquel le cron appartient</strong>.</p>
<p><strong>Concrètement </strong>si je fais ceci :</p>
<p><code>file_put_contents('temp.cron', '* * * * * cp /chemin/dun/autre/site/includes/passwordsdatabase.inc.php /chemin/de/mon/site/');<br />
shell_exec('crontab -u dtc /chemin/de/mon/site/temp.cron');</code></p>
<p>Hop, plus qu&rsquo;à attendre une minute et j&rsquo;aurais dans mes fichiers&#8230; <strong>les mots de passe de la base de données de mon voisin sur le serveur</strong>.</p>
<p><strong>C&rsquo;est un problème très important,</strong> donc, et je ne sais pas du tout comment DTC compte gérer les choses dans le futur puisque <strong>le safe_mode est amené à disparaîre </strong>: déjà considéré comme obsolète dans PHP 5, il sera définitivement supprimé avec PHP 6.</p>
<p>Il est possible que &#8211; comme souvent en informatique &#8211; GPLHost (éditeur de DTC) dise simplement &laquo;&nbsp;Logiciel compatible uniquement avec les versions suivantes de PHP : &#8230;.&nbsp;&raquo;.</p>
<p>En attendant, vous êtes donc maintenant au courant : <strong>NE DESACTIVEZ PAS </strong>LE SAFE_MODE PHP SI VOUS UTILISEZ DTC AVEC PLUSIEURS SITES DIFFERENTS.</p>
<p>Cependant, il y a certainement une alternative à cela : j&rsquo;imagine bien que PHP ou Apache ont la possibilité d&rsquo;interdire certaines commandes. Ainsi lorsque vous désactivez le safe_mode, pensez à interdire l&rsquo;utilisation de la commande shell_exec().</p>
<p>Voilà c&rsquo;était le bulletin sécurité (en exclu !!) du Troll <img src="//trollfactory.fr/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" /></p>
Share and Enjoy:<a rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Ftrollfactory.fr%2Fdu-safe_mode-avec-dtc-danger-securite-70" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/printfriendly.png" class="sociable-img sociable-hovers" title="Print" alt="Print" /></a><a rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Ftrollfactory.fr%2Fdu-safe_mode-avec-dtc-danger-securite-70" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/pdf.png" class="sociable-img sociable-hovers" title="PDF" alt="PDF" /></a><a rel="nofollow" target="_blank"  href="http://twitter.com/home?status=Du%20safe_mode%20avec%20DTC%20%3A%20danger%20%26%20s%C3%A9curit%C3%A9%20-%20http%3A%2F%2Ftrollfactory.fr%2Fdu-safe_mode-avec-dtc-danger-securite-70" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/twitter.png" class="sociable-img sociable-hovers" title="Twitter" alt="Twitter" /></a><a rel="nofollow" target="_blank"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Ftrollfactory.fr%2Fdu-safe_mode-avec-dtc-danger-securite-70&amp;t=Du%20safe_mode%20avec%20DTC%20%3A%20danger%20%26%20s%C3%A9curit%C3%A9" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/facebook.png" class="sociable-img sociable-hovers" title="Facebook" alt="Facebook" /></a><a rel="nofollow" target="_blank"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Ftrollfactory.fr%2Fdu-safe_mode-avec-dtc-danger-securite-70&amp;title=Du%20safe_mode%20avec%20DTC%20%3A%20danger%20%26%20s%C3%A9curit%C3%A9&amp;source=The+Troll%26%23039%3Bs+factory+Geekeries+%26amp%3B+pens%C3%A9es&amp;summary=DTC%20utilise%20un%20syst%C3%A8me%20d%27arborescence%20et%20de%20chroot%20pour%20g%C3%A9rer%20tous%20les%20fichiers%20avec%20un%20seul%20user%20tout%20en%20engiguant%20les%20scripts.%20Cependant%2C%20si%20l%27on%20d%C3%A9sactive%20le%20safe_mode%20dans%20PHP%2C%20alors%20le%20monde%20s%27osbcurcie%20et...%20%5Blisez%20la%20suite%20%21%5D" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/linkedin.png" class="sociable-img sociable-hovers" title="LinkedIn" alt="LinkedIn" /></a><a rel="nofollow" target="_blank"  href="http://trollfactory.fr/feed" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/rss.png" class="sociable-img sociable-hovers" title="RSS" alt="RSS" /></a><a rel="nofollow" target="_blank"  href="http://www.wikio.fr/vote?url=http%3A%2F%2Ftrollfactory.fr%2Fdu-safe_mode-avec-dtc-danger-securite-70" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/wikio.png" class="sociable-img sociable-hovers" title="Wikio FR" alt="Wikio FR" /></a><a rel="nofollow" target="_blank"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Ftrollfactory.fr%2Fdu-safe_mode-avec-dtc-danger-securite-70&amp;title=Du%20safe_mode%20avec%20DTC%20%3A%20danger%20%26%20s%C3%A9curit%C3%A9&amp;bodytext=DTC%20utilise%20un%20syst%C3%A8me%20d%27arborescence%20et%20de%20chroot%20pour%20g%C3%A9rer%20tous%20les%20fichiers%20avec%20un%20seul%20user%20tout%20en%20engiguant%20les%20scripts.%20Cependant%2C%20si%20l%27on%20d%C3%A9sactive%20le%20safe_mode%20dans%20PHP%2C%20alors%20le%20monde%20s%27osbcurcie%20et...%20%5Blisez%20la%20suite%20%21%5D" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/digg.png" class="sociable-img sociable-hovers" title="Digg" alt="Digg" /></a><a rel="nofollow" target="_blank"  href="http://delicious.com/post?url=http%3A%2F%2Ftrollfactory.fr%2Fdu-safe_mode-avec-dtc-danger-securite-70&amp;title=Du%20safe_mode%20avec%20DTC%20%3A%20danger%20%26%20s%C3%A9curit%C3%A9&amp;notes=DTC%20utilise%20un%20syst%C3%A8me%20d%27arborescence%20et%20de%20chroot%20pour%20g%C3%A9rer%20tous%20les%20fichiers%20avec%20un%20seul%20user%20tout%20en%20engiguant%20les%20scripts.%20Cependant%2C%20si%20l%27on%20d%C3%A9sactive%20le%20safe_mode%20dans%20PHP%2C%20alors%20le%20monde%20s%27osbcurcie%20et...%20%5Blisez%20la%20suite%20%21%5D" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/delicious.png" class="sociable-img sociable-hovers" title="del.icio.us" alt="del.icio.us" /></a><a rel="nofollow" target="_blank"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Ftrollfactory.fr%2Fdu-safe_mode-avec-dtc-danger-securite-70&amp;title=Du%20safe_mode%20avec%20DTC%20%3A%20danger%20%26%20s%C3%A9curit%C3%A9&amp;annotation=DTC%20utilise%20un%20syst%C3%A8me%20d%27arborescence%20et%20de%20chroot%20pour%20g%C3%A9rer%20tous%20les%20fichiers%20avec%20un%20seul%20user%20tout%20en%20engiguant%20les%20scripts.%20Cependant%2C%20si%20l%27on%20d%C3%A9sactive%20le%20safe_mode%20dans%20PHP%2C%20alors%20le%20monde%20s%27osbcurcie%20et...%20%5Blisez%20la%20suite%20%21%5D" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/googlebookmark.png" class="sociable-img sociable-hovers" title="Google Bookmarks" alt="Google Bookmarks" /></a><a rel="nofollow" target="_blank"  href="http://technorati.com/faves?add=http%3A%2F%2Ftrollfactory.fr%2Fdu-safe_mode-avec-dtc-danger-securite-70" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/technorati.png" class="sociable-img sociable-hovers" title="Technorati" alt="Technorati" /></a><a rel="nofollow" target="_blank"  href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Ftrollfactory.fr%2Fdu-safe_mode-avec-dtc-danger-securite-70" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/sphinn.png" class="sociable-img sociable-hovers" title="Sphinn" alt="Sphinn" /></a><a rel="nofollow" target="_blank"  href="http://www.mixx.com/submit?page_url=http%3A%2F%2Ftrollfactory.fr%2Fdu-safe_mode-avec-dtc-danger-securite-70&amp;title=Du%20safe_mode%20avec%20DTC%20%3A%20danger%20%26%20s%C3%A9curit%C3%A9" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/mixx.png" class="sociable-img sociable-hovers" title="Mixx" alt="Mixx" /></a><a rel="nofollow" target="_blank" title="Add to favorites" href="#" onclick="AddToFavorites(); return false;"><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/addtofavorites.png" class="sociable-img sociable-hovers" title="Add to favorites" alt="Add to favorites" /></a><a rel="nofollow" target="_blank"  href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Ftrollfactory.fr%2Fdu-safe_mode-avec-dtc-danger-securite-70&amp;title=Du%20safe_mode%20avec%20DTC%20%3A%20danger%20%26%20s%C3%A9curit%C3%A9" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/live.png" class="sociable-img sociable-hovers" title="Live" alt="Live" /></a><a rel="nofollow" target="_blank"  href="http://www.netvibes.com/share?title=Du%20safe_mode%20avec%20DTC%20%3A%20danger%20%26%20s%C3%A9curit%C3%A9&amp;url=http%3A%2F%2Ftrollfactory.fr%2Fdu-safe_mode-avec-dtc-danger-securite-70" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/netvibes.png" class="sociable-img sociable-hovers" title="Netvibes" alt="Netvibes" /></a><a rel="nofollow" target="_blank"  href="http://www.scoopeo.com/scoop/new?newurl=http%3A%2F%2Ftrollfactory.fr%2Fdu-safe_mode-avec-dtc-danger-securite-70&amp;title=Du%20safe_mode%20avec%20DTC%20%3A%20danger%20%26%20s%C3%A9curit%C3%A9" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/scoopeo.png" class="sociable-img sociable-hovers" title="Scoopeo" alt="Scoopeo" /></a><a rel="nofollow" target="_blank"  href="http://www.viadeo.com/shareit/share/?url=http%3A%2F%2Ftrollfactory.fr%2Fdu-safe_mode-avec-dtc-danger-securite-70&title=Du%20safe_mode%20avec%20DTC%20%3A%20danger%20%26%20s%C3%A9curit%C3%A9&urllanguage=fr" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/viadeo.png" class="sociable-img sociable-hovers" title="viadeo FR" alt="viadeo FR" /></a><a rel="nofollow" target="_blank"  href="http://identi.ca/notice/new?status_textarea=http%3A%2F%2Ftrollfactory.fr%2Fdu-safe_mode-avec-dtc-danger-securite-70" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/identica.png" class="sociable-img sociable-hovers" title="Identi.ca" alt="Identi.ca" /></a><a rel="nofollow" target="_blank"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Ftrollfactory.fr%2Fdu-safe_mode-avec-dtc-danger-securite-70&amp;t=Du%20safe_mode%20avec%20DTC%20%3A%20danger%20%26%20s%C3%A9curit%C3%A9" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/myspace.png" class="sociable-img sociable-hovers" title="MySpace" alt="MySpace" /></a><a rel="nofollow" target="_blank"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Ftrollfactory.fr%2Fdu-safe_mode-avec-dtc-danger-securite-70&amp;title=Du%20safe_mode%20avec%20DTC%20%3A%20danger%20%26%20s%C3%A9curit%C3%A9" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/stumbleupon.png" class="sociable-img sociable-hovers" title="StumbleUpon" alt="StumbleUpon" /></a><a rel="nofollow" target="_blank"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Ftrollfactory.fr%2Fdu-safe_mode-avec-dtc-danger-securite-70&amp;submitHeadline=Du%20safe_mode%20avec%20DTC%20%3A%20danger%20%26%20s%C3%A9curit%C3%A9&amp;submitSummary=DTC%20utilise%20un%20syst%C3%A8me%20d%27arborescence%20et%20de%20chroot%20pour%20g%C3%A9rer%20tous%20les%20fichiers%20avec%20un%20seul%20user%20tout%20en%20engiguant%20les%20scripts.%20Cependant%2C%20si%20l%27on%20d%C3%A9sactive%20le%20safe_mode%20dans%20PHP%2C%20alors%20le%20monde%20s%27osbcurcie%20et...%20%5Blisez%20la%20suite%20%21%5D&amp;submitCategory=science&amp;submitAssetType=text" ><img src="//trollfactory.fr/wp-content/plugins/sociable-30/images/default/16/yahoobuzz.png" class="sociable-img sociable-hovers" title="Yahoo! Buzz" alt="Yahoo! Buzz" /></a><br/><br/>]]></content:encoded>
			<wfw:commentRss>http://trollfactory.fr/du-safe_mode-avec-dtc-danger-securite-70/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
