时间本地时间

时间:2014-07-10 16:12:30

标签: php mysql

我只是将我的cms转移到新的os服务器,如下所示:

Apache24 PHP5.5.14 MySQL的

当我在/index.php上使用用户名和密码登录管理区域时,我按下提交页面重定向到同一页面,空白页面显示数字' 1'在那个页面上。基本上它会重定向到main / manage.php。

我检查php错误日志,发现如下:

PHP Notice:  Use of undefined constant TIME_LOCAL_TIME - assumed 'TIME_LOCAL_TIME' in J:\WebDocs\gad\manage\index.php on line 15

这是php代码从第10行到第17行开始

{
    $userId = getSessionArrayValue('UserId');
    $ip = getServerArrayValue('REMOTE_ADDR');
    $action = "Logged in user name: $username";
    $db->addlog($userId, $ip, $action, TIME_LOCAL_TIME);
    redirect("main/manage.php");
}

这个问题与php版本有关吗?我该怎么做才能解决这个问题。

2 个答案:

答案 0 :(得分:1)

我认为TIME_LOCAL_TIME是在OLD系统中定义的常量。不是php错误。这显然是一个警告。 TIME_LOCAL_TIME未定义。在php.net中搜索“TIME_LOCAL_TIME”,我没有得到任何结果。所以,我认为这只是旧的配置。

我建议在代码中定义常量,而不是在服务器中定义。原因是如果更改服务器,则必须记住修复配置。此外,您可以自动化这些东西。自动,(可)消除“失败”和/或人为干扰的可能性。

答案 1 :(得分:-2)

PHP 5.5.14中缺少

; This directive allows you to enable and disable warnings which PHP will issue
; if you pass a value by reference at function call time. Passing values by
; reference at function call time is a deprecated feature which will be removed
; from PHP at some point in the near future. The acceptable method for passing a
; value by reference to a function is by declaring the reference in the functions
; definition, not at call time. This directive does not disable this feature, it
; only determines whether PHP will warn you about it or not. These warnings
; should enabled in development environments only.
; Default Value: On (Suppress warnings)
; Development Value: Off (Issue warnings)
; Production Value: Off (Issue warnings)
; http://php.net/allow-call-time-pass-reference
allow_call_time_pass_reference = Off

; Safe Mode
; http://php.net/safe-mode
safe_mode = Off

; By default, Safe Mode does a UID compare check when
; opening files. If you want to relax this to a GID compare,
; then turn on safe_mode_gid.
; http://php.net/safe-mode-gid
safe_mode_gid = Off

; When safe_mode is on, UID/GID checks are bypassed when
; including files from this directory and its subdirectories.
; (directory must also be in include_path or full path must
; be used when including)
; http://php.net/safe-mode-include-dir
safe_mode_include_dir =

; When safe_mode is on, only executables located in the safe_mode_exec_dir
; will be allowed to be executed via the exec family of functions.
; http://php.net/safe-mode-exec-dir
safe_mode_exec_dir =

; Setting certain environment variables may be a potential security breach.
; This directive contains a comma-delimited list of prefixes.  In Safe Mode,
; the user may only alter environment variables whose names begin with the
; prefixes supplied here.  By default, users will only be able to set
; environment variables that begin with PHP_ (e.g. PHP_FOO=BAR).
; Note:  If this directive is empty, PHP will let the user modify ANY
;   environment variable!
; http://php.net/safe-mode-allowed-env-vars
safe_mode_allowed_env_vars = PHP_

; This directive contains a comma-delimited list of environment variables that
; the end user won't be able to change using putenv().  These variables will be
; protected even if safe_mode_allowed_env_vars is set to allow to change them.
; http://php.net/safe-mode-protected-env-vars
safe_mode_protected_env_vars = LD_LIBRARY_PATH

现在正常工作。