1

Ubuntu 10.04 x32 に Apache、Php、Mysql をインストールしました。それらをインストールした後、いくつかのphpファイルにアクセスできません。APM がオンになっています。以下は、問題を解決するためのいくつかのファイルと .htaccess です。ブラウザに「アクセス可能」ファイルが表示されない場合は、サーバーがダウンしている可能性があります。

権限: phpinfo.php 644、index.php 600、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;
}

設定の何が問題なのか教えてください。

4

3 に答える 3

0

私はHtaccessが問題なく正しいことをテストします。

htaccessのこの行にコメントしてphpをテストします

  RewriteCond %{REQUEST_FILENAME} !-f

  RewriteCond %{REQUEST_FILENAME} !-d

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

正しく動作する場合hello.php、その意味の問題はインデックスphpコードにあります

問題が解決しない場合は、平均インデックスphpが正しく、問題は仮想ホスト部分のhttpd.confからのものだと思いました

他の問題が許可のようなこの問題を引き起こす可能性があります(あなたのphpファイルは、公開、グループ、所有者によることができる655という意味 である必要があります)readexecutereadexecutereadwrite

于 2013-03-06T06:46:43.743 に答える
0

本当に、ファイルにアクセスできませんか? この端から、私はできるからです。多くの理由が考えられる内部サーバー エラー (500) が表示されます。

最も一般的なのは、php ファイルの構文エラーです。たとえば、hello.php のソース コードを投稿してください。

于 2013-03-06T06:34:30.350 に答える
0

それらのファイルが表示されていHTTP 500 Internal server errorます。つまり、これらのファイルには、お使いのバージョンの PHP では機能しないコードが含まれていることを意味します。これらのファイルのコードを確認する必要があります

于 2013-03-06T06:33:51.950 に答える