iconv php extension installation without recompiling PHP
Overview :
Installing a single php extension without recompiling PHP is never been a difficult job but most of the people doesn’t know it which leads to re-compile whole php.. In this article i will explain how can you add new php extension without recompiling whole php.
In our example, i will tell you how can you add iconv php extension without recompiling PHP.
A sample error for iconv php extension which was not installed
Fatal error: Call to undefined function iconv() in /some/path/file.php line 12
iconv php extension necessary configuration & compilation :
View current php version
php -v
Output :
PHP 5.2.13 (cli) (built: Jun 23 2010 04:49:30)
Copyright (c) 1997-2010 The PHP Group
Downloading the same php version source code from php.net
cd /tmp/
wget http://museum.php.net/php5/php-5.2.13.tar.bz2
tar -jxf php-5.2.13.tar.bz2
cd php-5.2.13/ext/iconv
Prepare php extension to compile it.
phpize
Output :
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
aclocal
./configure
make
make install
You can can see iconv php extension is installed under php extensions directory:
ls /usr/local/lib/php/extensions/no-debug-non-zts-20060613/iconv.so
Enable iconv PHP extension in php.ini
echo "extension=iconv.so" >> /usr/local/lib/php.ini
Verify iconv :
php -i | grep -i "iconv support"
Output:
iconv support => enabled