【问题标题】:Fatal error: Uncaught Error: Call to undefined function mysql_pconnect() when using phpGACL致命错误:未捕获错误:使用 phpGACL 时调用未定义函数 mysql_pconnect()
【发布时间】:2019-07-04 08:44:38
【问题描述】:

gacl.ini.php 中使用带有db_type = "mysqli" 的phpGACL 仍然出现以下错误,

"致命错误:未捕获错误:调用未定义函数 mysql_pconnect()"

当创建 gacl 类但 phpGACL admin 工作正常。

<?php
    include ("gacl.class.php");
    $gacl = new gacl();
?>

我希望它应该像phpGACL admin 那样正常工作。

【问题讨论】:

  • 似乎您正在使用旧版本的 gacl 和 PHP 7+。你确定你有最新版本的课程吗?
  • 是的,我正在将我的服务器从 php5 升级到 php7。
  • mysqlp_connect 自 PHP 5 起已弃用,并已在 PHP 7 中删除。
  • 有什么解决办法吗?我希望 phpGACL 应该切换 ADODB 以使用基于 gacl.inc.php 配置的 mysqli 驱动程序。
  • 是的,GACL 存储库中的 ADODB 驱动程序已超过 13 年。 (当我得到正确的回购时)。您可以尝试将其替换为here 的 PHP 7 兼容版本

标签: php


【解决方案1】:

最后,我做了一个小补丁让它工作。 更改 gacl.class.php 第 110 行中的代码。

function gacl($options = NULL) {

function __construct($options = NULL)

创建 gacl 对象时,必须传递 db_type 参数,而不是依赖 gacl.ini.php 设置。

$gacl = new gacl(array("db_type"=>"mysqli"));

修改 gacl.class.php 第 455 行,删除并签名

$row =& $rs->FetchRow();

$row = $rs->FetchRow();

修改 profiler.inc 第 37、180 行

function Profiler( $output_enabled=false, $trace_enabled=false);

$tmp=split(" ",microtime());

function __construct( $output_enabled=false, $trace_enabled=false)

$tmp=explode(" ",microtime());

为了使GACL admin 内建完美运行,还需要将ADODB、Smarty2 更新到最新版本2.6.31(Smarty 3 不兼容)。 acl_debug.tpl 第 42 行添加 @ 符号到计数函数。

{if @count($acls) gt 0}

@ 符号以通过计数不可数错误作为快速修复。需要进一步研究代码以获得长期解决方案。

修复 group_admin.php 中的一个错误

$formatted_groups = $gacl_api->format_groups($gacl_api->sort_groups($group_type), HTML);

$formatted_groups = $gacl_api->format_groups($gacl_api->sort_groups($group_type), 'HTML');

【讨论】:

    猜你喜欢
    • 2018-01-18
    • 1970-01-01
    • 2018-04-15
    • 2019-05-22
    • 2017-01-27
    • 2016-04-07
    • 2017-08-19
    相关资源
    最近更新 更多