php错误提示:Deprecated: Function eregi() is deprecated
今天在利用一个正则时提示Deprecated: Function eregi() is deprecated in错误了,后来查询了一原因是我们php5.3,在5.3中己经不支持eregi函数了,可以直接使用preg_match来代替。
改前:function inject_check($sql_str) {
代码如下 | 复制代码 |
$sql_str = strtolower($sql_str); return eregi('fopen|post|eval|select|insert|and|or|update|delete|'|/*|*|../|./|union|into|load_file|outfile', $sql_str); // 进行过滤 } |
解决方法:
找到代码所在的文件 位置
代码如下 | 复制代码 |
|
注意:一定要加'/'开头与结束哦。
本文章来给大家介绍phpmyadmin无法连接:无效的设置解决办法,有需要了解的朋友可进入参考参考。
打开phpMyAdmin目录 找到phpMyAdmin的配置文件config.inc.php
将其中的
代码如下 | 复制代码 |
$cfg['Servers'][$i]['auth_type'] = 'config'; |
改为:
代码如下 | 复制代码 |
$cfg['Servers'][$i]['auth_type'] = 'cookie'; |
如果在执行php程序时看到这条警告:"Warning: Cannot modify header information - headers already sent by ...."
Few notes based on the following user posts:
有以下几种解决方法:
1. Blank lines (空白行):
Make sure no blank line after <?php ... ?> of the calling php scrīpt.
检查有<?php ... ?> 后面没有空白行,特别是include或者require的文件。不少问题是这些空白行导致的。
2. Use exit statement (用exit来解决):
Use exit after header statement seems to help some people
在header后加上exit();
header ("Location: xxx");
exit();
3a. Use Javascrīpt (用Javascrīpt来解决):
<? echo "<scrīpt> self.location( file.php );</scrīpt>"; ?>
Since it s a scrīpt, it won t modify the header until execution of Javascrīpt.
可以用Javascrīpt来代替header。另外需要注意,采用这种方法需要浏览器支持Javascrīpt.
3b. Use output buffering (用输出缓存来解决):
<?php ob_start(); ?>
... HTML codes ...
<?php
... PHP codes ...
header ("Location: ....");
ob_end_flush();
?>
另一篇文章
<?php
ob_start();
setcookie("username","宋岩宾",time()+3600);
echo "the username is:".$HTTP_COOKIE_VARS["username"]."n";
echo "the username is:".$_COOKIE["username"]."n";
print_r($_COOKIE);
?>
Warning: Cannot modify header information - headers already sent by出错的原因
我在php程序的头部加了,
header("cache-control:no-cache,must-revalidate");
之后页面就出现上面的错误,看了N个资料也没有结果。今天偶尔发现原来是我的php.ini里面的配置出了问题,在C:windows下找到php.ini文件
output_buffering默认为off的。
小提示,还有一个更好的解决办法就是在php.ini 然后把 output_buffering 设为 on [...]就不会出现这类问题了。
昨天在使用cookie时页面报错:php Cannot modify header information-headers already sent by了,下面我来总结关于报错的解决办法。
代码
代码如下 | 复制代码 |
<?php ob_start(); setcookie("username","宋岩宾",time()+3600); echo "the username is:".$HTTP_COOKIE_VARS["username"]."n"; echo "the username is:".$_COOKIE["username"]."n"; print_r($_COOKIE); ?> |
Warning: Cannot modify header information - headers already sent by出错的原因
我在php程序的头部加了,
header("cache-control:no-cache,must-revalidate");
原因分析
在PHP里Cookie的使用是有一些限制的。
1、使用setcookie必须在<html>标签之前
2、使用setcookie之前,不可以使用echo输入内容
3、直到网页被加载完后,cookie才会出现
4、setcookie必须放到任何资料输出浏览器前,才送出
.....
由于上面的限制,在使用setcookie()函数时,学会遇到 "Undefined index"、"Cannot modify header information - headers already sent by"…等问题,解决办法是在输出内容之前,产生cookie
解决办法
1在页面顶部的php标签中加入ob_start();
2在返回的信息下面加入ob_end_flush();
这样就可以屏蔽错误信息的现实了
但有的朋友说上面办法不行,后来我后来打开 php.ini 然后把 output_buffering 设为 on 。重起appache,OK。看来这才是解决办法。
另外有朋友说是编码问题,只要转换文档有uft-8就可以解决了,这里就不介绍了。
今天在运行phpmyadmin时页面突然出现了Fatal error: Out of memory (allocated 786432)提示,看英文的意思是说超过了指定内存大小了,下面我来介绍解决办法
错误提示:
Fatal error: Out of memory (allocated 786432) (tried to allocate 393216 bytes) in E:xxxxlibrariescommon.lib.php on line 3135
解决办法
一,在你程序页面加入
代码如下 | 复制代码 |
ini_set('memory_limit',"256M") |
即可。
二,在php.ini中修改
打开php.ini 修改
代码如下 | 复制代码 |
memory_limit = 1024M |
的这行
依照服务器配置进行调整配置的内存使用大小修改后重启iis/apache
相关文章
php错误提示 open_basedir restriction in effect 解决
今天在帮助一个朋友配置一台服务器时发现网站配置好了缓存目录读写不成功,在打开错误时发现提示 Warning: file_exists() [function.file-exists]: open_basedir restr...2016-11-25Notice:undefined index ..错误提示解决方法
这句是在php开发中会碰的一些问题,看这提示我们都知道是变量未定义,那么下面来解决Notice:undefined index方法, 一,这个因为是变量未定义我们只要找到相关的位置加...2016-11-25php错误提示:Call-time pass-by-reference has been deprecated
今天在写引用时突然出现了Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, mo...2016-11-25apahce错误提示the requested operation has failed
找到解决方法: 运行cmd 进入到apache的bin目录。输入httpd.exe -w -n "Apache2.2" -k start 看到这个哥就笑了 原来是180行有问题 找到的时候才知道 180行这个 DocumentRoot...2016-01-28- 本文章介绍了在php开发中的一些php 关闭错误提示方法,有需要的朋友可参考本文章。 一,关闭notice错误提示 1、在php.ini文件中改动error_reporting 改为: 代...2016-11-25
- 下面来看一篇关于Android.mk文件写法及错误提示原因分析,这个看是写错了还是逻辑错误吧,具体的来参考这篇教程。 //根据文档中的提示创建的Android.mk中的文本 ...2016-10-02
apache启动错误提示:httpd: Could not reliably determine the server
错误提示 在系统启动时apache,没有启动起来,查看“事件查看器”发现报一些错误: The Apache service named reported the following error: >>> httpd.exe: Could...2016-01-28linux中phpMyAdmin错误提示Wrong permissions on configuration file, should not be world writable
我用的linux系统,今天使用phpmyadmin时出现Wrong permissions on configuration file, should not be world writable!错误提示, 查资料一看,原来phpMyAdmin要在755...2016-11-25php下foreach()错误提示Warning: Invalid argument supplied for foreach()
Warning: Invalid argument supplied for foreach() 的中文意思是说foreach需要是一个数组而给它的是一个无效的参数。 在没有购物商品直接进入购物车时竟然出现...2016-11-25php错误提示:Deprecated: Function eregi() is deprecated
今天在利用一个正则时提示Deprecated: Function eregi() is deprecated in错误了,后来查询了一原因是我们php5.3,在5.3中己经不支持eregi函数了,可以直接使用preg_match来代替。...2016-11-25- 本文章介绍在php中关闭notice错误的一些做法,但是不得不说的是在关掉错误提示时,那么程序代码中大量的notice级别错误是否会造成PHP性能下降 PHP Notice: Undefine...2016-11-25
- 公司的服务器用的是wdcp搭建的环境,安装非常方便,但是在开发的过程可能把函数名之内的东西写错了,服务器直接返回的是500错误,没有任何错误提示,只是告诉你500错误,很让人头...2016-11-25
Apache错误提示:Invalid command ScriptAlias
在apache启动我们会发现错误日志中会有 Syntax error on line 16 of /etc/apache2/sites-enabled/project: Invalid command 'ScriptAlias', perhaps misspelled or defined...2016-01-28session Cannot send session cache limiter 错误提示
开始时经常会碰到如下提示 warning: session_start() [function.session-start]: cannot send session cache limiter - headers already sent (output started at e:p...2016-11-25- 在php中开启与关闭错误提示的方法有几种一种可以直接在程序中使用相关函数来开户,另一种我们可以使用php.ini中配置参数来控制,下面小编来给各位同学介绍一下。 win...2016-11-25
- 这篇文章主要介绍了PHP常见错误提示含义解释,包含了各种常见的PHP错误提示及具体含义,便于查询参考,需要的朋友可以参考下...2016-04-28
网站 501 Method Not Implemented错误提示
有的朋友说 服务器加载security_module 模块导致。 如果服务器端解决可以 将/etc/conf.d/mod_security.conf 中的 代码如下 复制代码 loadfile /usr/...2016-01-28- php页面空白我们从几个方法入手,一个是php把错误提醒功能给关闭了,另一个是程序没有返回结果,当然如果是使用了php操作数据库我们可以数据库报错未进行判断处理,下面我们...2016-11-25