<?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>Naeh.net &#187; libmagic</title>
	<atom:link href="http://naeh.net/tag/libmagic/feed/" rel="self" type="application/rss+xml" />
	<link>http://naeh.net</link>
	<description>Le mémo du développeur</description>
	<lastBuildDate>Thu, 09 Sep 2010 15:30:32 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Comment installer fileinfo sous debian</title>
		<link>http://naeh.net/installation-fileinfo/</link>
		<comments>http://naeh.net/installation-fileinfo/#comments</comments>
		<pubDate>Wed, 14 May 2008 15:43:14 +0000</pubDate>
		<dc:creator>Naeh</dc:creator>
				<category><![CDATA[Linux - Logiciels]]></category>
		<category><![CDATA[PHP / MySQL]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[apt-get]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[fileinfo]]></category>
		<category><![CDATA[libmagic]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[phpize]]></category>

		<guid isPermaLink="false">http://naeh.net/installation-fileinfo/</guid>
		<description><![CDATA[Les fonctions de l'extension FileInfo essaient de savoir le type de contenu et l’encodage d’un fichier en regardant certaines séquences d’octet "magique" à des positions spécifiques à l’intérieur du fichier. Bien qu'il ne s'agit pas d'une approche infaillible, la méthode heuristique effectue un très bon travail.
le problème avec cette extension c'est qu'elle est un peu [...]]]></description>
			<content:encoded><![CDATA[<p>Les fonctions de l'extension <a href="http://fr3.php.net/manual/fr/book.fileinfo.php" target="_blank">FileInfo</a> essaient de savoir le type de contenu et l’encodage d’un fichier en regardant certaines séquences d’octet "magique" à des positions spécifiques à l’intérieur du fichier. Bien qu'il ne s'agit pas d'une approche infaillible, la méthode heuristique effectue un très bon travail.</p>
<p>le problème avec cette extension c'est qu'elle est un peu dur à installer, en réalité pas si dur que ça, il suffit de prendre le temps de le faire. Il faut juste savoir qu'un simple <strong>apt-get install php5-fileinfo</strong> ne suffira pas, tout simplement parce qu'il n'existe pas de paquet debian pour cette extension (pas encore...).</p>
<p>Donc pour l'installer, voici la procédure :<br />
Il faut d'abord installer <a href="http://pear.php.net/manual/fr/introduction.php" target="_blank">PEAR</a> :</p>

<div class="wp_codebox"><table><tr id="p517"><td class="code" id="p51code7"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> php-pear</pre></td></tr></table></div>

<p>ensuite il faut installer php5-dev si ce n'est pas déjà fait, ceci installera phpize ce qui nous évitera l'erreur :</p>

<div class="wp_codebox"><table><tr id="p518"><td class="code" id="p51code8"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sh</span>: phpize: <span style="color: #7a0874; font-weight: bold;">command</span> not found
ERROR: <span style="color: #000000; font-weight: bold;">`</span>phpize<span style="color: #ff0000;">' failed</span></pre></td></tr></table></div>

<p>installation de php5-dev :</p>

<div class="wp_codebox"><table><tr id="p519"><td class="code" id="p51code9"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> php5-dev</pre></td></tr></table></div>

<p>c'est presque bon mais pas encore :<br />
maintenant il faut installer libmagic pour nous éviter une erreur lors de l'installation de fileinfo :</p>

<div class="wp_codebox"><table><tr id="p5110"><td class="code" id="p51code10"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> libmagic-dev</pre></td></tr></table></div>

<p>maintenant tout est bon, nous allons enfin pouvoir lancer l'installation de notre extension :</p>

<div class="wp_codebox"><table><tr id="p5111"><td class="code" id="p51code11"><pre class="bash" style="font-family:monospace;">pecl <span style="color: #c20cb9; font-weight: bold;">install</span> fileinfo</pre></td></tr></table></div>

<p>Voilà, maintenant fileinfo est installée, nous allons pouvoir vérifier les types mime des fichiers avec des méthodes plus fiables ;-)</p>
<p>Normalement tout devrait fonctionner maintenant, mais il ce peut que l'extension ne soit pas activée comme il faut, dans ce cas il faudra créer un fichier <strong>fileinfo.ini</strong> dans <strong>/etc/php5/apache2/conf.d</strong> avec le contenu suivant :</p>

<div class="wp_codebox"><table><tr id="p5112"><td class="code" id="p51code12"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">extension</span>=fileinfo.so</pre></td></tr></table></div>

<p>reloader apache avec /etc/init.d/apache2 reload et le tour est joué :)</p>
]]></content:encoded>
			<wfw:commentRss>http://naeh.net/installation-fileinfo/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
