CI 묻고 답하기

제목 Your system folder path does not appear to be set correctly. Please open the following file and correct this: index.php
카테고리 기타 솔루션
글쓴이 휴먼 작성시각 2018/04/19 18:08:21
댓글 : 7 추천 : 0 스크랩 : 0 조회수 : 55437   RSS

서버 환경  CentOS 6.9 / Apache 2.2.15 / PHP 5.3.3, 7.0.10 / MySQL 5.1.73 / WebPanel Virtualmin 6.02

 

수고 많습니다.

CI로 만들어진 오픈소스 POS 프로그램 하나를 서버에 올려서 접속하면, 제목과 같은 오류가 나서 도움을 청합니다.

db는 import 되어 있고, MySQL 설정도 맞춰져 있습니다.

오픈소스 install guide는 아래 링크에서볼 수 있습니다.

http://www.opensourceposguide.com/guide/gettingstarted/installation

 

주소 창에 주소( http://(MyDomain)/index.php )를 치면 순간적으로 아래와 같은 긴 주소가 주소 창에 나타나면서 위 제목과 같은 오류가 나타나고 있습니다. http://(MyDomain)/index.phppublic/public/public/public/public/public/public/public/public/public/public/

당초 서버의 Home Directory는 public_html 이었는데, public 으로 설정을 변경하였습니다.

혹시 서버의 해당 계정에 CodeIgniter를 설치해주어야 작동되는 것인지요?

 

Your system folder path does not appear to be set correctly. Please open the following file and correct this: index.php

 

이 페이지에 연결할 수 없음

리디렉션이 너무 많습니다.

오류 코드: INET_E_REDIRECT_FAILED

 

 

아래는 public 폴더에 있는 .htaccess 파일의 내용이고,

그 밑에 index.php 파일의 내용을 첨부합니다.

RewriteEngine On

# To redirect a subdomain to a subdir because of https not supporting wildcards# replace values between <> with your ones# RewriteCond %{HTTP_HOST} ^<OSPOS subdomain>\.<my web domain>\.com$ [OR]# RewriteCond %{HTTP_HOST} ^www\.<OSPOS subdomain>\.<my web domain>\.com$# RewriteRule ^/?$ "https\:\/\/www\.<my web domain>\.com\/<OSPOS path>" [R=301,L]

# To rewrite "domain.com -> www.domain.com" uncomment the following lines.# RewriteCond %{HTTPS} !=on# RewriteCond %{HTTP_HOST} !^www\..+$ [NC]# RewriteCond %{HTTP_HOST} (.+)$ [NC]# RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-d# if in web rootRewriteRule ^(.*)$ index.php?/$1 [L]

# if in subdir comment above line, uncomment below one and replace <OSPOS path> with your path# RewriteRule ^(.*)$ /<OSPOS path>/public/index.php?/$1 [L]

# disable directory browsing# For security reasons, Option all cannot be overridden.#Options All -IndexesOptions +ExecCGI +Includes +IncludesNOEXEC +SymLinksIfOwnerMatch -Indexes

# prevent folder listingIndexIgnore *

# Apache 2.4<IfModule authz_core_module>  # secure htaccess file  <Files .htaccess>    Require all denied  </Files>  # prevent access to PHP error log  <Files error_log>    Require all denied  </Files></IfModule>

# Apache 2.2<IfModule !authz_core_module>  # secure htaccess file  <Files .htaccess>    Order allow,deny    Deny from all    Satisfy all  </Files>  # prevent access to PHP error log  <Files error_log>    Order allow,deny    Deny from all    Satisfy all  </Files></IfModule>

<IfModule mod_expires.c>  <FilesMatch "\.(jpe?g|png|gif|js|css)$">    ExpiresActive On    ExpiresDefault "access plus 1 week"  </FilesMatch></IfModule>

 

<?php
/**
 * CodeIgniter
 *
 * An open source application development framework for PHP
 *
 * This content is released under the MIT License (MIT)
 *
 * Copyright (c) 2014 - 2016, British Columbia Institute of Technology
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 * @package	CodeIgniter
 * @author	EllisLab Dev Team
 * @copyright	Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
 * @copyright	Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
 * @license	http://opensource.org/licenses/MIT	MIT License
 * @link	https://codeigniter.com
 * @since	Version 1.0.0
 * @filesource
 */

/*
 *---------------------------------------------------------------
 * APPLICATION ENVIRONMENT
 *---------------------------------------------------------------
 *
 * You can load different configurations depending on your
 * current environment. Setting the environment also influences
 * things like logging and error reporting.
 *
 * This can be set to anything, but default usage is:
 *
 *     development
 *     testing
 *     production
 *
 * NOTE: If you change these, also change the error_reporting() code below
 */
	define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'production');

/*
 *---------------------------------------------------------------
 * ERROR REPORTING
 *---------------------------------------------------------------
 *
 * Different environments will require different levels of error reporting.
 * By default development will show errors but testing and live will hide them.
 */
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 DIRECTORY NAME
 *---------------------------------------------------------------
 *
 * This variable must contain the name of your "system" directory.
 * Set the path if it is not in the same directory as this file.
 */
	$system_path = '../vendor/codeigniter/framework/system';

/*
 *---------------------------------------------------------------
 * APPLICATION DIRECTORY NAME
 *---------------------------------------------------------------
 *
 * If you want this front controller to use a different "application"
 * directory than the default one you can set its name here. The directory
 * can also be renamed or relocated anywhere on your server. If you do,
 * use an absolute (full) server path.
 * For more info please see the user guide:
 *
 * https://codeigniter.com/user_guide/general/managing_apps.html
 *
 * NO TRAILING SLASH!
 */
	$application_folder = '../application';

/*
 *---------------------------------------------------------------
 * VIEW DIRECTORY NAME
 *---------------------------------------------------------------
 *
 * If you want to move the view directory out of the application
 * directory, set the path to it here. The directory can be renamed
 * and relocated anywhere on your server. If blank, it will default
 * to the standard location inside your application directory.
 * If you do move this, use an absolute (full) server path.
 *
 * NO TRAILING SLASH!
 */
	$view_folder = '';


/*
 * --------------------------------------------------------------------
 * DEFAULT CONTROLLER
 * --------------------------------------------------------------------
 *
 * Normally you will set your default controller in the routes.php file.
 * You can, however, force a custom routing by hard-coding a
 * specific controller class/function here. For most applications, you
 * WILL NOT set your routing here, but it's an option for those
 * special instances where you might want to override the standard
 * routing in a specific front controller that shares a common CI installation.
 *
 * IMPORTANT: If you set the routing here, NO OTHER controller will be
 * callable. In essence, this preference limits your application to ONE
 * specific controller. Leave the function name blank if you need
 * to call functions dynamically via the URI.
 *
 * Un-comment the $routing array below to use this feature
 */
	// The directory name, relative to the "controllers" directory.  Leave blank
	// if your controller is not in a sub-directory within the "controllers" one
	// $routing['directory'] = '';

	// The controller class file name.  Example:  mycontroller
	// $routing['controller'] = '';

	// The controller function you wish to be called.
	// $routing['function']	= '';


/*
 * -------------------------------------------------------------------
 *  CUSTOM CONFIG VALUES
 * -------------------------------------------------------------------
 *
 * The $assign_to_config array below will be passed dynamically to the
 * config class when initialized. This allows you to set custom config
 * items or override any default config values found in the config.php file.
 * This can be handy as it permits you to share one application between
 * multiple front controller files, with each file containing different
 * config values.
 *
 * Un-comment the $assign_to_config array below to use this feature
 */
	// $assign_to_config['name_of_config_item'] = 'value of config item';



// --------------------------------------------------------------------
// END OF USER CONFIGURABLE SETTINGS.  DO NOT EDIT BELOW THIS LINE
// --------------------------------------------------------------------

/*
 * ---------------------------------------------------------------
 *  Resolve the system path for increased reliability
 * ---------------------------------------------------------------
 */

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

	if (($_temp = realpath($system_path)) !== FALSE)
	{
		$system_path = $_temp.DIRECTORY_SEPARATOR;
	}
	else
	{
		// Ensure there's a trailing slash
		$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
	}

/*
 * -------------------------------------------------------------------
 *  Now that we know the path, set the main path constants
 * -------------------------------------------------------------------
 */
	// 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);

/*
 * --------------------------------------------------------------------
 * LOAD THE BOOTSTRAP FILE
 * --------------------------------------------------------------------
 *
 * And away we go...
 */
require_once BASEPATH.'core/CodeIgniter.php';

 

 다음글 css,js파일 불러오기를 실패합니다. (3)
 이전글 Ajax Pagination 링크문의 (1)

댓글

양승현 / 2018/04/19 18:28:03 / 추천 0
웹서버의 documentRoot 설정을 public폴더로 설정하라고 하네요.

rewrite모듈도 설치하라고 써있긴한데 이미 있는것 같내요.
휴먼 / 2018/04/19 18:36:16 / 추천 0

예 그래서 documentRoot 설정이 public_html 로 되어 있던 것을 public 으로 변경했고 실제 폴더도 public 로 변경했습니다만...

변종원(웅파) / 2018/04/20 09:42:04 / 추천 0
시스템 디렉토리를 보니 composer로 설치한 codeigniter를 가르키고 있습니다. composer로 설치하셨는지요?
휴먼 / 2018/04/20 11:40:25 / 추천 0

아직 composer를 모르는 초보입니다.

그냥 다운로드 받은 것을 통째로 웹서버에 올렸을 뿐입니다.

CI를 공부한다고 작정한 것은 옛날인데, 여지껏 미적거리다가 뒤늦게 헤매고 있습니다.

변종원(웅파) / 2018/04/20 13:26:53 / 추천 0

휴먼/ 압축 풀어보니 vendor 디렉토리까지 다 압축을 해서 배포를 하네요.

.htaccess 를 제대로 수정하지 않으신 것 같네요.  <> 안의 내용을 실서버에 맞게 수정하고 앞에 주석을 풀어줘야 작동합니다.

휴먼 / 2018/04/20 13:50:40 / 추천 0

예, 이것참 공부는 하지도 않으면서 날로 먹을려고 하니, 헤매게 되는 모양입니다.

알려주신 부분을 다시 한번 잘 살펴보겠습니다.

감사합니다.

 

 

휴먼 / 2018/05/30 13:43:10 / 추천 0

이 부분 ,

위 프로그램의 필요조건이 있었는데, 제가 그 부분을 간과한 것 같고, 그 부분들을 제대로 설치해주고 진행했더니 아무 일없었다는 듯이 잘 실행되고 있습니다.

아래와 같은 모듈들입니다.

GD: OK bcmath: OK intl: OK sockets: OK mcrypt: OK
 

괸심가져 주시고 댓글 달아 주신분들께 감사드립니다.