cpanel登录网站文件夹时出现php警告
我正在用cpanel编写一些php脚本。当我访问网站文件夹时 (如www.bbbb.com/folder/) 它发出这样的警告cpanel登录网站文件夹时出现php警告,php,mysql,database,mysqli,web-config,Php,Mysql,Database,Mysqli,Web Config,我正在用cpanel编写一些php脚本。当我访问网站文件夹时 (如www.bbbb.com/folder/) 它发出这样的警告 Warning: mysqli::mysqli() [mysqli.mysqli]: (HY000/2005): Unknown MySQL server host 'host07.portalwebhosting' (1) in /home/restaur/public_html/restaurant/variables/variables.php on lin
Warning: mysqli::mysqli() [mysqli.mysqli]: (HY000/2005): Unknown MySQL server host 'host07.portalwebhosting' (1) in /home/restaur/public_html/restaurant/variables/variables.php on line 7
Warning: mysqli::set_charset() [mysqli.set-charset]: Couldn't fetch mysqli in /home/restaur/public_html/restaurant/includes/connect_database.php on line 3
Warning: mysqli::stmt_init() [mysqli.stmt-init]: Couldn't fetch mysqli in /home/restaur/public_html/restaurant/includes/login_form.php on line 45
Fatal error: Call to a member function prepare() on a non-object in /home/restaur/public_html/restaurant/includes/login_form.php on line 46
我使用默认的帐户admin来访问,它会给我相同的结果
这是我的php代码
<?php
// database configuration
$host ="host07.portalwebhosting.com";
$user ="user";
$pass ="password";
$database = "monkey";
$connect = new mysqli($host, $user, $pass,$database) or die("Error : ".mysql_error());
// access key to access API
$access_key = "12345";?>
检查连接字符串,或者可能需要尝试使用端口
$connection = new mysqli("host", "user", "pwd", "db", "3306");
默认情况下无需更改端口3306
为什么使用
die(“错误:.mysql_Error())
use mysqli是否可以从外部访问host07.portalwebhosting.com?你是否打开了一些端口并设置了一些MySQL设置?为什么不使用localhost
作为主机?我在host07.portalwebhosting.com中获得了一个donmain和hosting,但如何测试可访问性?你的意思是我将这句话替换为下面的一句$connect=new mysqli($host,$user,$pass,$database)还是die($Error:.mysql_Error());p、 s:在这种情况下,我使用的是Cpanel。我如何知道端口号?添加3306。这是默认值。您需要与主机提供商联系