Q. How do I install filter extension for safely dealing with input parameters supplied via a web form using filter_var()?
A. This extension is part of PHP Core version 5.20 and above. Unfortunately, RHEL / CentOS comes with PHP version 5.1.6. So you need to install this extension by typing the following commands.
Install php-devel
You need to install php-devel to compile php extensions:
# yum install php-devel
Download php source code
php_pcre.h header file is not includes with php source code 5.1.6, so you need php source code as well. Visit php.net to grab latest version and store to /opt directory. Use lynx and elinks:
# cd /opt
# elinks http://www.php.net/get/php-5.2.6.tar.bz2/from/a/mirror
Save php source to code to disk. Next, extract source code:
# tar -jxvf php-5.2.6.tar.bz2
Download filter extension
Visit pecl extension to grab latest source code for filter:
# cd /opt
# wget http://pecl.php.net/get/filter-0.11.0.tgz
Install filter extension
Unrar file:
# tar -jxvf filter-0.11.0.tgz
# cd filter-0.11.0
Open logical_filters.c file:
# vi logical_filters.c
Find line that read as follows:
#include "ext/pcre/php_pcre.h"
Change to (the absolute path of php_pcre.h is required):
#include "/opt/php-5.2.6/ext/pcre/php_pcre.h"
Save and close the file. Finally, type the following commands to compile extension:
# phpize
# ./configure
# make install
Configure Filter Extension
Type the following command:
# echo 'extension=filter.so' > /etc/php.d/filter.ini
Restart httpd:
# service httpd restart
Featured Articles:
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- My 10 UNIX Command Line Mistakes
- 10 Greatest Open Source Software Of 2009
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- Top 20 OpenSSH Server Best Security Practices
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Linux Video Editor Software
- Email FAQ to a friend
- Download PDF version
- Printable version
- Comment RSS feed
- Last Updated: 09/16/08




{ 2 comments… read them below or add one }
You also need to install pcre-devel.
# yum install pcre-develHai
Can u help us for installing apc extension. We are on suse 10.3