2013-03-06 3 views
0

우분투 10.04 x32에 Apache, Php, Mysql을 설치했습니다. 설치 한 후에는 일부 PHP 파일에 액세스 할 수 없습니다. APM이 켜져 있습니다. 다음은 문제를 파악하기 위해 일부 파일과 .htaccess입니다. 브라우저에서 "액세스 할 수 있음"파일을 볼 수 없다면 서버가 다운되었을 수 있습니다.아파치에서 php 파일에 접근 할 수 없습니다.

권한 : phpinfo.php를 644, 600의 index.php, hello.php 600

[액세스 할 수]

http://222.118.53.30/phpinfo.php 
http://222.118.53.30/phpmyadmin 

[액세스 할 수없는]

http://222.118.53.30/index.php 
http://222.118.53.30/hello.php 

.haccess 다음을 따른다 :

SetEnv APPLICATION_ENV development 



Options -Indexes 

Options +FollowSymLinks 

DirectoryIndex index.php index.html 

<IfModule mod_rewrite.c> 

RewriteEngine on 

RewriteBase/

RewriteCond %{REQUEST_FILENAME} !-f 

RewriteCond %{REQUEST_FILENAME} !-d 

RewriteRule ^(.*)\?*$ index.php [L,QSA] 

#remove www. 

#RewriteCond %{HTTPS} off 

#RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] 

#RewriteRule ^(.*)$ http://%1/$1 [R=301,L] 

#RewriteRule ^(.*\.(png|jpg|jpeg|gif))$ index.php?controller=minify&action=index&file_path=$1&ext=$2 [L,NC] 

#RewriteRule ^(.*\.(css|js))$ index.php?controller=minify&action=jscss&file_path=$1&ext=$2 [L,NC] 


</IfModule> 

ErrorDocument 404 index.php 

<ifModule mod_expires.c> 

ExpiresActive On 

ExpiresDefault "access plus 1 seconds" 

ExpiresByType text/html "access plus 1 seconds" 

ExpiresByType image/gif "access plus 2592000 seconds" 

ExpiresByType image/jpeg "access plus 2592000 seconds" 

ExpiresByType image/png "access plus 2592000 seconds" 

ExpiresByType text/css "access plus 604800 seconds" 

ExpiresByType text/javascript "access plus 216000 seconds" 

ExpiresByType application/x-javascript "access plus 216000 seconds" 

</ifModule> 

<FilesMatch "\.(htaccess|htpasswd|ini|log|sh|inc|bak|cache)$"> 

Order Allow,Deny 

Deny from all 

</FilesMatch> 

[hello.php]

<?php 
echo "Hello World"; 
?> 

[index.php에]

<?php 

// Define application path 
defined('APPLICATION_PATH') 
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/application/')); 

// Define base path 
defined('BASE_PATH') 
|| define('BASE_PATH', realpath(dirname(__FILE__))); 

// Define application environment 
defined('APPLICATION_ENV') 
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production')); 

set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../JO/v.0.9b/'), 
realpath(APPLICATION_PATH . '/library/'), 
get_include_path(), 
))); 

require_once 'JO/Application.php'; 

// Create application, bootstrap, and run 
$application = new JO_Application(
APPLICATION_ENV, 
APPLICATION_PATH . '/config/application.ini', 
isset($argv) ? $argv : null 
); 

// Set Routers links 
$configs_files = glob(APPLICATION_PATH . '/config/config_*.ini'); 
if($configs_files) { 
foreach($configs_files AS $file) { 
    $config = new JO_Config_Ini($file); 
    $application->setOptions($config->toArray()); 
    JO_Registry::set(basename($file, '.ini'), $config->toArray()); 
} 
} 

// Set Routers links 
$routers_files = glob(APPLICATION_PATH . '/config/routers/*.ini'); 
if($routers_files) { 
foreach($routers_files AS $file) { 
    $config = new JO_Config_Ini($file, null, false, true); 
    $application->setOptions($config->toArray()); 
    JO_Registry::set('routers_'.basename($file, '.ini'), $config->toArray()); 
} 
} 

//dispatch application 
$application->dispatch(); 



// error handler function 
function myErrorHandler($errno, $errstr, $errfile, $errline) 
{ 
if (!(error_reporting() & $errno)) { 
    // This error code is not included in error_reporting 
    return; 
} 

switch ($errno) { 
case E_USER_ERROR: 
    echo "<b>My ERROR</b> [$errno] $errstr<br />\n"; 
    echo " Fatal error on line $errline in file $errfile"; 
    echo ", PHP " . PHP_VERSION . " (" . PHP_OS . ")<br />\n"; 
    echo "Aborting...<br />\n"; 
    exit(1); 
    break; 

case E_USER_WARNING: 
    echo "<b>My WARNING</b> [$errno] $errstr<br />\n"; 
    break; 

case E_USER_NOTICE: 
    echo "<b>My NOTICE</b> [$errno] $errstr<br />\n"; 
    break; 

default: 
    echo "Unknown error type: [$errno] $errstr<br />\n"; 
    break; 
} 

/* Don't execute PHP internal error handler */ 
return true; 
} 

당신이 내 구성에 어떤 문제가 있는지 좀 도와 주 시겠어요?

+1

어떤 메시지가 해당 URL을 방문하려고 할 때 표시됩니다? – vedarthk

+0

아무 것도 표시되지 않습니다 ... 브라우저를 통해 액세스 할 수 있습니다. 서버가 살아 있습니다. –

+0

또한'index.php'와'hello.php'의 코드를 게시하십시오 – vedarthk

답변

0

해당 파일은 HTTP 500 Internal server error입니다. 즉, 해당 파일에 PHP 버전에 맞지 않는 코드가 있음을 의미합니다. 이 파일의 코드를 살펴 봐야합니다

+0

hello.php에 대한 권한을 600에서 644로 변경합니다. 그것은 작동합니다. 하지만 600 허가와 함께 일해야한다고 생각합니다 .... –

+0

@SteveLee 600 권한은 '소유자 읽기 및 쓰기'를 의미합니다. 제대로 작업하려면 권한있는 사람이 PHP 파일을 실행할 수있는 권한 655를 입력해야합니다. –

+0

또는 웹 서버가 파일을 소유 할 수 있습니다.)하지만 644 ist는 일반적인 사용법입니다. – Jens

0

확실합니까? 파일에 액세스 할 수 있습니까? 이 목적 때문에, 할 수 있습니다. 나는 많은 이유가있을 수있는 내부 서버 오류 (500)를 얻는다.

가장 일반적인 것은 PHP 파일의 구문 오류입니다. 그러므로 hello.php의 소스 코드를 게시하십시오.

+0

코드를 게시했습니다 ... 인기있는 소프트웨어 중 하나이기 때문에 index.php 코드에는 문제가 없습니다. –

0

테스트 Htaccess는 문제없이 정확합니다. 문제는 그 인덱스 PHP가 정확하고 내가 문제가 생각 의미가 해결되지 않을 경우 제대로 그 문제를 의미

RewriteCond %{REQUEST_FILENAME} !-f 

    RewriteCond %{REQUEST_FILENAME} !-d 

    RewriteRule ^(.*)\?*$ index.php [L,QSA] 

작업 hello.php 경우 htaccess로의 주석이 라인으로

테스트 PHP는 인덱스 PHP 코드

에 가상 호스트 부분에 httpd.conf에서

다른 문제가 아마도 허가와 같은이 문제를 일으킬 수 있습니다 (귀하의 PHP 파일은 655이어야합니다.) read 및대중, read 및 소유자에 의해 그룹, readwrite에 의해 execute)

관련 문제