title: How can I force PHP to use the libiconv version of iconv instead of the CentOS-installed glibc version?
body: <p>The code I'm working on runs perfectly on Windows XP and on Mac OS X. When testing it on CentOS (and on Fedora and Ubuntu), it's not working properly. Searching the nets led me to the conclusion that it's the <code>glibc</code> version of the <code>iconv</code> that's causing the problem. So now I need the <code>libiconv</code> version of <code>iconv</code> for Zend Lucene to work properly.</p>
  
  <p>I already downloaded libiconv and configured it with <code>--prefix=/usr/local</code>, <code>make</code>, then <code>make install</code> without any errors. It seems that it was successfully installed because executing <code>/usr/local/bin/iconv --version</code> says the version is the <code>libiconv</code>. Although a simple <code>iconv --version</code> still gives the <code>glibc</code> version.</p>
  
  <p>Then I recompiled PHP from source using <code>--with-iconv=/usr/local</code>. But still, the <code>phpinfo()</code> is showing the <code>iconv</code> being used is the <code>glibc</code> version. I've also already tried several other compiles using <code>--with-iconv-dir</code> or using <code>/usr/local/bin/php</code>.</p>
  
  <p>Of course, I restarted the web server after recompiling PHP.</p>
  
  <p>I have the following line in my <code>/etc/httpd/conf/httpd.conf</code>:</p>
  
  <pre><code>LoadModule /usr/lib/httpd/modules/libphp5.so
  </code></pre>
  
  <p>and <code>libphp5.so</code> is actually in <code>/usr/lib/httpd/modules</code>.</p>
  
  <p><code>phpinfo()</code> shows PHP 5.3.3. I also yum removed the pre-installed PHP 5.1.* just to make sure. But the iconv is still using the glibc version.</p>
  
  <p><code>ldd /usr/lib/httpd/modules/libphp5.so</code> gives</p>
  
  <pre><code>linux-gate.so.1 =&gt;  (0x003b1000)
  /usr/local/lib/preloadable_libiconv.so (0x00110000)
  libcrypt.so.1 =&gt; /lib/libcrypt.so.1 (0x001ed000)
  librt.so.1 =&gt; /lib/librt.so.1 (0x0021f000)
  libmysqlclient.so.15 =&gt; /usr/lib/mysql/libmysqlclient.so.15 (0x003b2000)
  libldap-2.3.so.0 =&gt; /usr/lib/libldap-2.3.so.0 (0x0026e000)
  liblber-2.3.so.0 =&gt; /usr/lib/liblber-2.3.so.0 (0x00370000)
  libiconv.so.2 =&gt; /usr/local/lib/libiconv.so.2 (0x00516000)
  libfreetype.so.6 =&gt; /usr/lib/libfreetype.so.6 (0x002a8000)
  libpng12.so.0 =&gt; /usr/lib/libpng12.so.0 (0x00228000)
  libz.so.1 =&gt; /usr/lib/libz.so.1 (0x00328000)
  libcurl.so.3 =&gt; /usr/lib/libcurl.so.3 (0x00f23000)
  libm.so.6 =&gt; /lib/libm.so.6 (0x0033b000)
  libdl.so.2 =&gt; /lib/libdl.so.2 (0x00364000)
  libnsl.so.1 =&gt; /lib/libnsl.so.1 (0x0037e000)
  libxml2.so.2 =&gt; /usr/lib/libxml2.so.2 (0x00f5f000)
  libssl.so.6 =&gt; /lib/libssl.so.6 (0x0862c000)
  libcrypto.so.6 =&gt; /lib/libcrypto.so.6 (0x04145000)
  libgssapi_krb5.so.2 =&gt; /usr/lib/libgssapi_krb5.so.2 (0x08e2d000)
  libkrb5.so.3 =&gt; /usr/lib/libkrb5.so.3 (0x0611a000)
  libk5crypto.so.3 =&gt; /usr/lib/libk5crypto.so.3 (0x005f4000)
  libcom_err.so.2 =&gt; /lib/libcom_err.so.2 (0x0024e000)
  libidn.so.11 =&gt; /usr/lib/libidn.so.11 (0x071f5000)
  libc.so.6 =&gt; /lib/libc.so.6 (0x08aa6000)
  libpthread.so.0 =&gt; /lib/libpthread.so.0 (0x00397000)
  /lib/ld-linux.so.2 (0x00251000)
  libresolv.so.2 =&gt; /lib/libresolv.so.2 (0x0748a000)
  libsasl2.so.2 =&gt; /usr/lib/libsasl2.so.2 (0x07ddf000)
  libkrb5support.so.0 =&gt; /usr/lib/libkrb5support.so.0 (0x062b7000)
  libkeyutils.so.1 =&gt; /lib/libkeyutils.so.1 (0x00369000)
  libselinux.so.1 =&gt; /lib/libselinux.so.1 (0x0913b000)
  libsepol.so.1 =&gt; /lib/libsepol.so.1 (0x07eb4000)
  </code></pre>
  
  <p>This is a cross-post from: <a href="http://nullpointer.ph/questions/2922/how-can-i-force-php-to-use-the-libiconv-version-of-iconv-instead-of-the-centos-installed-glibc-version" rel="noreferrer">NullPointer.ph</a></p>