Laravel(新手) - 无法加载autoload.php

时间:2014-02-25 03:38:48

标签: php .htaccess laravel

当我通过作曲家创建本地项目时,我没有遇到任何问题。

现在我部署了我的应用程序并试图点击入口点(“/”),它可以工作:它执行预期的重定向到/ home。

BUT / home是问题:我得到(生产中)一个空(空白)响应,错误日志显示:

  

[2014年2月24日20:14:11] PHP致命错误:require()[function.require]:在'__DIR__/../bootstrap/autoload.php'中打开所需的'.:/usr/lib64/php:/usr/share/pear'(include_path = /home1/centrau9/public_html/index.php}失败在第21行

注意:文件存在,/ bootstrap /的权限是0755,autoload.php的权限是0644.框架是www-unreachable(即public_html对应于laravel项目的“public”目录)。

routes.php文件如下:

<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/

define('STATIC_URL', '/static/');

Route::get('/', function()
{
    return Redirect::route('home');
});

Route::get('home', array('as' => 'home', function()
{
    return Response::make(
        View::make('home_html'), 200,
        array('Content-Type' => 'text/html; charset=utf-8')
    );
}));

Route::get('nosotros', array('as' => 'nosotros', function()
{
    return Response::make(
        View::make('nosotros_html'), 200,
        array('Content-Type' => 'text/html; charset=utf-8')
    );
}));

Route::get('modelos/{clase}/{modelo}', array('as' => 'modelos', function($clase, $modelo)
{
    $modelos = CentralCarController::datosModelos();
    if (!isset($modelos[$clase]))
    {
        App::abort(404, 'No se puede encontrar la página');
    }
    $datosModelo = null;
    foreach($modelos[$clase] as $modelo_)
    {
        if ($modelo_['name'] == $modelo)
        {
            $datosModelo = $modelo_;
        }
    }
    if (!$datosModelo)
    {
        App::abort(404, 'No se puede encontrar la página');
    }

    return Response::make(
        View::make('modelos_html', array('model_class' => json_encode($clase), 'model_name' => json_encode($modelo))), 200,
        array('Content-Type' => 'text/html; charset=utf-8')
    );
}))->where(array('clase' => '[\w-]+', 'modelo' => '[\d\w-]+'));

Route::get('posventa', array('as' => 'posventa', function()
{
    return Response::make(
        View::make('posventa_html'), 200,
        array('Content-Type' => 'text/html; charset=utf-8')
    );
}));

Route::match(array('GET', 'POST'), 'contacto', array('as' => 'contacto', 'uses' => 'CentralCarController@contactoConsulta'));
Route::match(array('GET', 'POST'), 'contacto-cotizar', array('as' => 'contacto-cotizar', 'uses' => 'CentralCarController@contactoCotizar'));
Route::match(array('GET', 'POST'), 'contacto-cita', array('as' => 'contacto-cita', 'uses' => 'CentralCarController@contactoTaller'));
Route::get('contacts-export/{periodo?}', array('as' => 'exportar', 'uses' => 'CentralCarController@exportar'))->where(array('periodo' => '[DWMY]|6M'));
Route::get('models-data', array('as' => 'models-data', 'uses' => 'CentralCarController@modelos'));
Route::get('busqueda', array('as' => 'busqueda', 'uses' => 'CentralCarController@busqueda'));

和public_html中的.htaccess文件如下:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

2 个答案:

答案 0 :(得分:2)

您可能正在运行PHP 5.2。检查您的PHP版本。你需要&gt; 5.3

答案 1 :(得分:0)

找到答案:错误的php版本(5.2.x)。