Php 无法使用Hostinger中提供的设置连接到数据库服务器
我用php开发了一个应用程序,它是在Php 无法使用Hostinger中提供的设置连接到数据库服务器,php,codeigniter,Php,Codeigniter,我用php开发了一个应用程序,它是在CodeIgniter中开发的。我想在我的托管网站hostinger上测试我的应用程序,所以我已经上传了所有文件,并配置了连接到数据库的脚本。但我得到了这个信息: 无法使用提供的设置连接到数据库服务器 在我的Hostinger帐户信息中,我可以看到: host: http://xxx.xx.xx database host: xxx.xxx.xxx database name: xxx database username: xxx database passw
CodeIgniter
中开发的。我想在我的托管网站hostinger上测试我的应用程序,所以我已经上传了所有文件,并配置了连接到数据库的脚本。但我得到了这个信息:
无法使用提供的设置连接到数据库服务器
在我的Hostinger帐户信息中,我可以看到:
host: http://xxx.xx.xx
database host: xxx.xxx.xxx
database name: xxx
database username: xxx
database password: ******
这是我的配置
文件:
<?php
class SystemConfiguration {
// General Settings
public static $base_url = 'http://primodebug.esy.es/Calendario/';
// Database Settings
public static $db_host = 'xxx';
public static $db_name = 'xxx';
public static $db_username = 'xxx';
public static $db_password = '*****';
// Google Calendar API Settings
public static $google_sync_feature = FALSE; // Enter TRUE or FALSE;
public static $google_product_name = '';
public static $google_client_id = '';
public static $google_client_secret = '';
public static $google_api_key = '';
}
/* End of file configuration.php */
/* Location: ./configuration.php */
这个错误非常广泛:
- 检查主机名。是本地主机吗?请改为尝试127.0.0.1
- mysql是外部的(不是web服务器的ip)?将web服务器ip添加到mysql数据库的访问列表中
- 您是否连接到端口3306?可能您的托管伙伴使用的端口不是默认的3306端口
- 你的证件正确吗
- 用户有足够的权限吗
$db['default']['db_debug'] = TRUE;
致:
如果有人知道如何才能帮助我和其他人理解为什么,那么现在看来是可行的。谢谢大家的帮助。祝您过得愉快:)可能重复感谢Alex,但我刚刚阅读了这个问题,用户使用了OK,但问题仍然没有解决。@Alex:与typesafe无关。并非所有主机都启用了短标记。
$db['default']['db_debug'] = TRUE;
$db['default']['db_debug'] = FALSE;