【发布时间】:2019-10-15 21:07:04
【问题描述】:
我有一个小问题。每次在 PHP 7.2 中执行这行代码时,我的应用程序都会遇到错误 500(PHP 5.6 很好)
function selfDbDM($query,$type=0)
{
global $db;
static $db_exe = array();
$error = 0;
if($type==0)
{
$db_exe[] = $query;
}
else
{
//Do Something
}
}
调用脚本只是调用 selfDbDM('SQL 查询 ...'); selfDbDM('SQL QUERY 2 ...'); 等等
然后它调用 selfDbDM('',1); 将每个更改提交到 DB。
我就是这样做的,这样我就可以以一种简单的方式使用 mysqli_autocommit。
现在的问题是,我已经切换服务器以获得更好的性能,现在代码不再工作了。
编辑:
错误日志
[2019 年 10 月 15 日星期二 22:55:51.371463] [fcgid:warn] [pid 11859:tid 140389409335040] [client 37.201.185.7:8833] mod_fcgid: stderr: Stack trace:, referer: https://xyz/index.php?page=contract_new&step=2
[2019 年 10 月 15 日星期二 22:55:51.371468] [fcgid:warn] [pid 11859:tid 140389409335040] [client 37.201.185.7:8833] mod_fcgid: stderr: #0 /var/www/vhosts/xyz/public /system/page/contract_new.php(171): selfDbDM('INSERT INTO `ko...'), referer: https://xyz/index.php?page=contract_new&step=2
[2019 年 10 月 15 日星期二 22:55:51.371472] [fcgid:warn] [pid 11859:tid 140389409335040] [client 37.201.185.7:8833] mod_fcgid: stderr: #1 /var/www/vhosts/xyz/public /system/page/contract_new.php(340):contract_new_save_step2(),referer:https://xyz/index.php?page=contract_new&step=2
[2019 年 10 月 15 日星期二 22:55:51.371477] [fcgid:warn] [pid 11859:tid 140389409335040] [client 37.201.185.7:8833] mod_fcgid: stderr: #2 /var/www/vhosts/xyz/include /core.function.php(300):init_contract_new(),referer:https://xyz/index.php?page=contract_new&step=2
[2019 年 10 月 15 日星期二 22:55:51.371481] [fcgid:warn] [pid 11859:tid 140389409335040] [client 37.201.185.7:8833] mod_fcgid: stderr: #3 /var/www/vhosts/xyz/public /system/index.php(58): include_page('contract_new', '/var/www/vhosts...', '/var/www/vhosts...'), referer: https://xyz/index.php?page=contract_new&step=2
[2019 年 10 月 15 日星期二 22:55:51.371485] [fcgid:warn] [pid 11859:tid 140389409335040] [client 37.201.185.7:8833] mod_fcgid: stderr: #4 {main}, referer: https://xyz/index.php?page=contract_new&step=2
[2019 年 10 月 15 日星期二 22:55:51.372000] [fcgid:warn] [pid 11859:tid 140389409335040] [client 37.201.185.7:8833] mod_fcgid: stderr: throw in /var/www/vhosts/xyz/include /functions_mysql.php 在第 132 行,引用者:https://xyz/index.php?page=contract_new&step=2
编辑 2:
致命错误:未捕获错误:/var/www/vhosts/cash-keeper.eu/dev2.cash-keeper.eu/include/functions_mysql.php:132 中的字符串不支持 [] 运算符
【问题讨论】:
-
启用错误报告并检查您的日志。如果有任何内容,请更新您的帖子以包含这些内容(如果有)。
-
我无法重现:3v4l.org/PRAuh
-
@FunkFortyNiner 完成
-
@Phil 更新了 PHP 设置,现在又出现了一个错误。