2012-08-02 1 views
0

처음에는 죄송 합니다만, 정말 큰 초심자인데, 그렇게 느껴지신다면이 질문에 투표하실 수 있습니다.FuelPHP은 (는) 공중에서 URL을 제거합니다.

그래서 많은 튜토리얼을 살펴 보았습니다. 나에게 맞는 것은 공용 폴더 콘텐츠를 가져 오는 것입니다.

그리고 문제는 많은 오류가 발생합니다.

오류 :

Warning: require(\bootstrap.php) [function.require]: failed to open stream: No such file or directory in C:\EasyPHP\www\fuelphp\index.php on line 33 

Fatal error: require() [function.require]: Failed opening required '\bootstrap.php' (include_path='.;C:\php\pear') in C:\EasyPHP\www\fuelphp\index.php on line 33 

은 그래서 DOCROOT이 C:\EasyPHP\www\fuelphp\ 것을 발견, 그래서 난 로컬 호스트/fuelphp/연료/코어

원래의 색인이

처럼 보이는이 방법으로 물건을 당겨야합니다 이

,563에 수정보다
<?php 
/** 
* Set error reporting and display errors settings. You will want to change these when in production. 
*/ 
error_reporting(-1); 
ini_set('display_errors', 1); 

/** 
* Website document root 
*/ 
define('DOCROOT', __DIR__.DIRECTORY_SEPARATOR); 

/** 
* Path to the application directory. 
*/ 
define('APPPATH', realpath(__DIR__.'/../fuel/app/').DIRECTORY_SEPARATOR); 

/** 
* Path to the default packages directory. 
*/ 
define('PKGPATH', realpath(__DIR__.'/../fuel/packages/').DIRECTORY_SEPARATOR); 

/** 
* The path to the framework core. 
*/ 
define('COREPATH', realpath(__DIR__.'/../fuel/core/').DIRECTORY_SEPARATOR); 

// Get the start time and memory for use later 
defined('FUEL_START_TIME') or define('FUEL_START_TIME', microtime(true)); 
defined('FUEL_START_MEM') or define('FUEL_START_MEM', memory_get_usage()); 

// Boot the app 
require APPPATH.'bootstrap.php'; 

// Generate the request, execute it and send the output. 
try 
{ 
    $response = Request::forge()->execute()->response(); 
} 
catch (HttpNotFoundException $e) 
{ 
    $route = array_key_exists('_404_', Router::$routes) ? Router::$routes['_404_']->translation : Config::get('routes._404_'); 
    if ($route) 
    { 
     $response = Request::forge($route)->execute()->response(); 
    } 
    else 
    { 
     throw $e; 
    } 
} 

// This will add the execution time and memory usage to the output. 
// Comment this out if you don't use it. 
$bm = Profiler::app_total(); 
$response->body(
    str_replace(
     array('{exec_time}', '{mem_usage}'), 
     array(round($bm[0], 4), round($bm[1]/pow(1024, 2), 3)), 
     $response->body() 
    ) 
); 

$response->send(true); 

43,210

이제 대중은 URL에없는,하지만 난이 사이트를 열 때 오류의 무리를 받고 메신저, 나는 백 슬래시 UTS 슬래시의 insted 볼 수 있지만, 캔트 정말 문제

Warning: require_once(fuel/core/classes\error.php) [function.require-once]: failed to open stream: No such file or directory in C:\EasyPHP\www\fuelphp\fuel\core\base.php on line 25 

Fatal error: require_once() [function.require]: Failed opening required 'fuel/core/classes\error.php' (include_path='.;C:\php\pear') in C:\EasyPHP\www\fuelphp\fuel\core\base.php on line 25 
을 찾을 수

누군가가 인덱스를 수정하는 방법에 대한 힌트를 모든 사람에게 알릴 수 있습니까?

답변

3

당신이 시도하고있는 무슨을 달성하기 위해 인덱스 파일을 수정할 필요가 없습니다 감사합니다.

연료는 문서 루트 (docroot) 위에 상주하도록 설계되었습니다. docroot가 www/인 것으로 보입니다.

이 다음과 같이 디렉토리 구조는 사실에 있어야한다는 것을 의미 :

C:\EasyPHP\fuelphp\ 
C:\EasyPHP\www\ 

FuelPHP zip 파일 또는 자식 클론 (또는 그러나 당신이 그것을 얻을 수는) public 제목의 폴더가 포함되어 있습니다. 이 폴더는 docroot로 간주되는 이름이므로 상황에 따라 의 내용을 www/

으로 복사해야합니다. 시도 할 때 문서 루트에 모든 것을 설정할 수 있으며 프로세스는 문서화되어 있습니다. FuelPHP 웹 사이트 here.

As explained in point 3, for security reasons it is strongly advised NOT to install Fuel inside your webserver's document root.

However, there are cases where you would like to do that, [...]

In that case, you need an additional .htaccess file that you need to place in your document root, which will redirect requests to the site root to your public folder, and also modifies the rewrites to include the public folder:

<IfModule mod_rewrite.c> 
    RewriteEngine on 

    RewriteBase /public 

    RewriteRule ^(/)?$ index.php/$1 [L] 

    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 

    RewriteRule ^(.*)$ index.php/$1 [L] 
</IfModule> 

index.php를 기본 구성이 고려 기본적/연료/폴더의 위치를 ​​취하는. 경로 정의를 다음과 같은 예를 들어 가지고 당신이 http://project.dev/을 직접 당신은 또한 가상 호스트를 사용할 수 있습니다 realpath()

+0

루트에 htaccess로 추가 지금 잘 작동, 마지막 질문은이 htaccess로를 사용하는 것이 안전합니다? 왜냐하면 이제는 http : // localhost/fueljob/그리고 http : // localhost/fueljob/public에이 방법으로 액세스 할 수 있기 때문에 이것이 문제가되지 않기 때문입니까? – Side

+0

그건 문제가 아니에요. 후자의 URL을 통해 .htaccess를 사용하여 액세스 할 때 액세스를 거부 할 수 있습니다. 정말로 원했지만 문제가 아니며 사용하는 것이 안전하다고 말할 수 있습니다. –

+0

도움을 주셔서 대단히 감사합니다. – Side

0

를 사용하지 않고 코드에 /를 하드 코딩했기 때문에 당신이 다양한 방향 슬래시를 얻고있는 이유는

define('COREPATH', realpath(__DIR__.'/../fuel/core/').DIRECTORY_SEPARATOR); 

__DIR__ - Path of current working directory, i.e. wherever index.php is 
..   - go up a directory, i.e. directory above wherever index.php is 
fuel/  - Fuel folder 
core/  - Core folder within fuel/ 

realpath() - Resolves the .. to it's real location and makes sure/is correct or changes to \ depending on the OS 

프로젝트의 공개 경로파일에서

0

:

C:\EasyPHP\www\fuelphp\public\.htaccess

설정 RewriteBase이 값 : /easyphp/www/fuelphp/public

관련 문제