Php 获取错误505,无法运行我的网站

Php 获取错误505,无法运行我的网站,php,Php,我从网上下载的管理面板有问题。我确实上传到了DreamHost,并为域名和计划付费所有文件都已上载,但当我打开页面的URL时,仍然会出现相同的错误500。 已经联系了DreamHost,他们帮了我很多忙-问题既不是来自服务器,也不是来自与数据库的连接。如果你们能帮助我,我将非常感激 我相信错误就在这里 <?php define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'production'); s

我从网上下载的管理面板有问题。我确实上传到了DreamHost,并为域名和计划付费所有文件都已上载,但当我打开页面的URL时,仍然会出现相同的错误500。 已经联系了DreamHost,他们帮了我很多忙-问题既不是来自服务器,也不是来自与数据库的连接。如果你们能帮助我,我将非常感激

我相信错误就在这里

<?php

define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'production');

switch (ENVIRONMENT) {
case 'development':
    error_reporting(-1);
    ini_set('display_errors', 1);
break;

case 'testing':
case 'production':
    ini_set('display_errors', 0);
    if (version_compare(PHP_VERSION, '5.3', '>=')) {
        error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
    } else {
        error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE);
    }
break;

default:
    header('HTTP/1.1 503 Service Unavailable.', true, 503);
    echo 'The application environment is not set correctly.';
    exit(1); // EXIT_ERROR
}

$system_path = 'system';

$application_folder = 'application';

$view_folder = '';

if (defined('STDIN')) {
    chdir(dirname(__FILE__));
}

if (($_temp = realpath($system_path)) !== false) {
    $system_path = $_temp.DIRECTORY_SEPARATOR;
} else {
    $system_path = strtr(
        rtrim($system_path, '/\\'),
        '/\\',
        DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
    ).DIRECTORY_SEPARATOR;
}

// Is the system path correct?
if (!is_dir($system_path)) {
    header('HTTP/1.1 503 Service Unavailable.', true, 503);
    echo 'Your system folder path does not appear to be set correctly. Please open the following file and correct this: '.pathinfo(__FILE__, PATHINFO_BASENAME);
    exit(3); // EXIT_CONFIG
}

// The name of THIS file
define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));

// Path to the system directory
define('BASEPATH', $system_path);

// Path to the front controller (this file) directory
define('FCPATH', dirname(__FILE__).DIRECTORY_SEPARATOR);

// Name of the "system" directory
define('SYSDIR', basename(BASEPATH));

// The path to the "application" directory
if (is_dir($application_folder)) {
    if (($_temp = realpath($application_folder)) !== false) {
        $application_folder = $_temp;
    } else {
        $application_folder = strtr(
            rtrim($application_folder, '/\\'),
            '/\\',
            DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
        );
    }
} elseif (is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR)) {
    $application_folder = BASEPATH.strtr(
        trim($application_folder, '/\\'),
        '/\\',
        DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
    );
} else {
    header('HTTP/1.1 503 Service Unavailable.', true, 503);
    echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.self;
    exit(3); // EXIT_CONFIG
}

define('APPPATH', $application_folder.DIRECTORY_SEPARATOR);

// The path to the "views" directory
if (!isset($view_folder[0]) && is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR)) {
    $view_folder = APPPATH.'views';
} elseif (is_dir($view_folder)) {
    if (($_temp = realpath($view_folder)) !== false) {
        $view_folder = $_temp;
    } else {
        $view_folder = strtr(
            rtrim($view_folder, '/\\'),
            '/\\',
            DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
        );
    }
} elseif (is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR)) {
    $view_folder = APPPATH.strtr(
        trim($view_folder, '/\\'),
        '/\\',
        DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
    );
} else {
    header('HTTP/1.1 503 Service Unavailable.', true, 503);
    echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.self;
    exit(3); // EXIT_CONFIG
}

define('VIEWPATH', $view_folder.DIRECTORY_SEPARATOR);

require_once BASEPATH.'core/CodeIgniter.php';
下面是我用来管理数据库的用户

和数据库连接


请检查服务器的PHP版本。检查CodeIgniter服务器要求

如果满足服务器要求,则打开application/config/config.php文件并将错误记录阈值设置为1


现在,您将在application/logs目录中看到与PHP相关的错误

您应该能够从错误日志文件中读取错误,您可能在.htaccess文件中遇到错误

但在这种情况下,您可以检查代码的每一行,看看是什么导致了错误

下面的例子将告诉您如何做到这一点,这是一个有效的例子

请阅读代码中的注释

define('ENVIRONMENT', 'development');
if (defined('ENVIRONMENT')){
    switch (ENVIRONMENT){
      case 'development':
       error_reporting(E_ALL);
      break;

      case 'testing':
      case 'production':
       error_reporting(0);
      break;

      default:
       exit('The application environment is not set correctly.');
    }
}
$system_path = '/sitefolder/system';
$application_folder = '/sitefolder/application';

// Set the current directory correctly for CLI requests
if (defined('STDIN')){
  chdir(dirname(__FILE__));
}

if (realpath($system_path) !== FALSE){
  $system_path = realpath($system_path).'/';
}

// ensure there's a trailing slash
$system_path = rtrim($system_path, '/').'/';

// Is the system path correct?
if (!is_dir($system_path)){
  exit("Your system folder path does not appear to be set correctly. Please open the following file and correct this: ".pathinfo(__FILE__, PATHINFO_BASENAME));
}

// The name of THIS file
define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));

// The PHP file extension
// this global constant is deprecated you can comment it or remove.
define('EXT', '.php');

// Path to the system folder
define('BASEPATH', str_replace("\\", "/", $system_path));

// Path to the front controller (this file)
define('FCPATH', str_replace(SELF, '', __FILE__));

// Name of the "system folder"
define('SYSDIR', trim(strrchr(trim(BASEPATH, '/'), '/'), '/'));


// The path to the "application" folder
if (is_dir($application_folder)){
  define('APPPATH', $application_folder.'/');
}else{
  if (!is_dir(BASEPATH.$application_folder.'/')){
   exit("Your application folder path does not appear to be set correctly. Please open the following file and correct this: ".SELF);
  }

  define('APPPATH', BASEPATH.$application_folder.'/');
}

require_once BASEPATH.'core/CodeIgniter.php';
注意:您可能需要更改文件夹或目录的权限

你的.htaccess应该是这样的

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ yoursitefolder/index.php/$1 [L,QSA]
完整的例子见这个问题


有关错误500,请参见此处:

刚刚发现问题^。^是数据库连接…

服务器为7.2及以上版本。我刚更改了这行,但什么也没发生。仍然显示500错误。您是否设置了.htaccess?如果您这样做了,您可以按照文档进行操作。那么我认为这是htaccess重写的问题。请配置htaccess重写并重新启动服务器。请参阅错误日志。您应该能够看到导致该错误的原因
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ yoursitefolder/index.php/$1 [L,QSA]