已弃用:mysql_connect() 消息和警告出现在我们输入详细信息并点击继续后的 opencart 配置设置的第 3 步中

Deprecated: mysql_connect() message and Warnings occur in step 3 of the opencart configuration setup after we enter the details and hit continue

我们需要帮助尝试在 godaddy 上正确上传我们的 opencart templatemonster.com 模板,但我们不清楚如何做到这一点。

仅供参考 我们的 public_html/system/database 文件夹也包含一个 mysqli.php 文件。

  1. 我们确保通过完整包(文件名为 themeXXX(full).zip,其中 XXX 是您的主题编号)将模板上传到 public_html 文件夹。
  2. 解压缩 public_html 文件夹中的 zip 文件。
  3. 使用安装管理器执行安装。
  4. 在第 3 步配置中,系统提示我们输入数据库访问详细信息并确保数据库为空。 (GoDaddy 告诉我们使用本地主机)

点击后继续:

已弃用:mysql_connect() 在我们输入详细信息并点击继续后,opencart 配置设置的第 3 步中出现消息和警告。

Where ‘store’ is the new directory name. Where ‘user’ is your server account address. Where ‘yourdomainname.co.uk’ is the web domain of your new website:

(虚拟 LINK 用于演示目的)http://www.yourdomainname.co.uk/install/index.php?route=step_3

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/user /public_html/system/database/mysql.php on line 6

第 5-16 行:

public function __construct($hostname, $username, $password, $database) {
    if (!$this->link = mysql_connect($hostname, $username, $password)) {
        trigger_error('Error: Could not make a database link using ' . $username . '@' . $hostname);
    }

    if (!mysql_select_db($database, $this->link)) {
        trigger_error('Error: Could not connect to database ' . $database);
    }

错误:

Warning: Cannot modify header information - headers already sent by (output started at /home/user/public_html/system/database/mysql.php:6) in /home/user/public_html/system/engine/controller.php on line 28

Warning: Cannot modify header information - headers already sent by (output started at /home/user/public_html/system/database/mysql.php:6) in /home/user/public_html/system/engine/controller.php on line 29

第 27-31 行

protected function redirect($url, $status = 302) {
    header('Status: ' . $status);
    header('Location: ' . str_replace(array('&', "\n", "\r"), array('&', '', ''), $url));
    exit();             
}

模板功能

可用资源

PSD PNG PHP TPL JS

托管要求

OpenCart Templates Help Center

需要软件

一位评论者说

mysql_ calls will work on this server but are causing deprecation notices. A quick fix would be to turn off warnings in your php.ini file, in your error_reporting value. Or you could try turning off display errors, set display_errors to 0.

我喜欢这个评论,但有人可以为这个建议提供稍微更全面的解释或视觉资源吗?如进一步阐明如何进行?我应该通过 GoDaddys public FTP 下载文件还是应该使用 FileZilla FTP 客户端(这很重要),制作副本,进行适当的更改然后重新上传?

我喜欢可能的解决方案,但我很想知道是否只有这些。

更新

php.ini

magic_quotes_gpc = Off;
register_globals = Off;
default_charset = UTF-8;
memory_limit = 64M;
max_execution_time = 36000;
upload_max_filesize = 999M;
safe_mode = Off;
mysql.connect_timeout = 20;
session.use_only_cookies = On;
session.use_trans_sid = Off;
session.cookie_httponly = On;
session.gc_maxlifetime = 172800;
allow_url_fopen = on;
;display_errors = 0;
;error_reporting = E_ALL;

???

我也有类似经历!您不需要启用这些扩展 PHP 版本需要更新:

  1. 登录 GoDaddy

  2. 转到右上角您登录名下的“我的产品”。

  3. 转到虚拟主机并单击“管理”按钮。
  4. 再次点击管理。
  5. 滚动到软件 header 并单击 "Select PHP Version"
  6. 然后更改为未弃用此扩展的较早版本。

告诉我这对你有用。