我昨晚尝试在我的新VPS上安装IIS 8.5,MySQL和PHP,并且失败了。
与许多其他HTTP错误404.0,0x80070002错误不同,我的网站可以运行PHP页面但是如果它尝试连接到MySQL数据库则无法找到该页面。
我整晚都在寻找解决问题的方法,因为没有找到解决方案。
这是错误页面本身:
非常感谢您提前,
阿龙
修改 Index.PHP代码:
<?php
define('IN_INDEX', 1);
require_once 'global.php';
$core->handleCall($engine->secure($_GET['url']));
$template->write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
$template->write('<html xmlns="http://www.w3.org/1999/xhtml">');
$template->write('<head>');
$template->write('<title>');
$template->write('Chrome: Index');
$template->write('</title>');
$template->css->get();
$template->js->get();
$template->write('</head>');
$template->write('<body>');
$template->html->get($engine->secure($_GET['url']));
$template->write('</body>');
$template->write('</html>');
$template->outputTPL();
?>
在此页面上注释掉global.php将允许加载页面。
Global.PHP:
<?php
// Special Functions
function filter($var)
{
return mysql_real_escape_string(stripslashes(htmlspecialchars($var)));
}
if(!defined('IN_INDEX')) { die('Sorry, you cannot access this file.'); }
if(isset($_SERVER['HTTP_CF_CONNECTING_IP'])) { $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CF_CONNECTING_IP']; }
error_reporting(E_ALL ^ E_NOTICE);
define('A', 'app/');
define('I', 'interfaces/');
define('M', 'management/');
define('T', 'tpl/');
//REVOLUTION
use Revolution as Rev;
//INTERFACES
require_once A . I . 'interface.core.php';
require_once A . I . 'interface.engine.php';
require_once A . I . 'interface.users.php';
require_once A . I . 'interface.template.php';
//TPL
require_once A . T . I . 'interface.forms.php';
//HTML
require_once A . T . I . 'interface.html.php';
//CSS
require_once A . T . I . 'interface.css.php';
//JS
require_once A . T . I . 'interface.js.php';
//CLASSES
//app
require_once A . 'class.core.php';
require_once A . 'class.engine.php';
require_once A . 'class.users.php';
require_once A . 'class.template.php';
//MANAGEMENT
require_once A . M . 'config.php';
require_once A . M . 'recaptchalib.php';
//TPL
require_once A . T . 'class.forms.php';
//HTML
require_once A . T . 'class.html.php';
//CSS
require_once A . T . 'class.css.php';
//JS
require_once A . T . 'class.js.php';
//OBJ
$core = new Rev\core();
$engine = new Rev\engine();
$users = new Rev\users();
$template = new Rev\template();
$template->form = new Rev\forms();
$template->html = new Rev\html();
$template->css = new Rev\css();
$template->js = new Rev\js();
//START
session_start();
$engine->Initiate();
$template->Initiate();
?>
(删除Global.PHP文件中的config.php将允许加载页面)
CONFIG.PHP:
error_reporting(0);
if(!defined('IN_INDEX')) { die('Sorry, you cannot access this file.'); }.
/*
*
* MySQL management
*
*/
$_CONFIG['mysql']['connection_type'] = 'pconnect'; //Type of connection.
$_CONFIG['mysql']['hostname'] = 'localhost'; //MySQL host
$_CONFIG['mysql']['username'] = 'root'; //MySQL username
$_CONFIG['mysql']['password'] = 'PASSWORD'; //MySQL password
$_CONFIG['mysql']['database'] = 'chrome_db'; //MySQL database
$_CONFIG['mysql']['port'] = '3306'; //MySQL's port
?>