php 调用未定义的函数 filter_var()

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11735538/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 01:58:20  来源:igfitidea点击:

Call to undefined function filter_var()

php

提问by Avdept

After transfering my site to another hosting i got this error:

将我的网站转移到另一个主机后,我收到此错误:

    Fatal error: Call to undefined function filter_var() in
 /home/ultrastep/ultrastep.ru/docs/sites/all/modules/q_cart/q_cart.module on line 410

PHP version on server is 5.2.10.

服务器上的 PHP 版本是 5.2.10。

Any ideas whats wrong?

任何想法有什么问题?

回答by ragnar

You need to have the php module "Filter" installed

您需要安装php模块“过滤器”

回答by blizz

In case someone else stumbles upon this like I did, here is the solution I found for Redhat/CentOS:

如果其他人像我一样偶然发现了这一点,这是我为 Redhat/CentOS 找到的解决方案:

http://www.cyberciti.biz/faq/rhel-cento-linux-install-php-pecl-filter/

http://www.cyberciti.biz/faq/rhel-cento-linux-install-php-pecl-filter/

Install php-devel You need to install php-devel to compile php extensions:

安装 php-devel 需要安装 php-devel 来编译 php 扩展:

yum install php-devel

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:

下载 php 源代码 php_pcre.h 头文件不包含在 php 源代码 5.1.6 中,因此您还需要 php 源代码。访问 php.net 获取最新版本并存储到 /opt 目录。使用 lynx 和 elinks:

cd /opt

cd /opt

elinks http://www.php.net/get/php-5.2.6.tar.bz2/from/a/mirror

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:

将 php 源代码保存到磁盘。接下来,提取源代码:

tar -jxvf php-5.2.6.tar.bz2

tar -jxvf php-5.2.6.tar.bz2

Download filter extension Visit pecl extension to grab latest source code for filter:

下载过滤器扩展访问 pecl 扩展以获取过滤器的最新源代码:

cd /optwget http://pecl.php.net/get/filter-0.11.0.tgz

cd /optwget http://pecl.php.net/get/filter-0.11.0.tgz

Install filter extension Unrar file:

安装过滤器扩展 Unrar 文件:

tar -jxvf filter-0.11.0.tgz

tar -jxvf filter-0.11.0.tgz

cd filter-0.11.0

cd filter-0.11.0

Open logical_filters.c file:

打开 logical_filters.c 文件:

vi logical_filters.c

vi logical_filters.c

Find line that read as follows:

查找如下所示的行:

include "ext/pcre/php_pcre.h"

include "ext/pcre/php_pcre.h"

Change to (the absolute path of php_pcre.h is required):

改为(需要php_pcre.h的绝对路径):

include "/opt/php-5.2.6/ext/pcre/php_pcre.h"

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

phpize

./configure

./configure

make install

make install

Configure Filter Extension Type the following command:

配置过滤器扩展 键入以下命令:

echo 'extension=filter.so' > /etc/php.d/filter.ini

echo 'extension=filter.so' > /etc/php.d/filter.ini

Restart httpd:

重启httpd:

service httpd restart

service httpd restart