简体   繁体   English

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

[英]Laravel (newbie) - Failed to load autoload.php

When I created the local project via composer I ran my application with no problems. 当我通过composer创建本地项目时,我运行我的应用程序没有任何问题。

Now I deployed my application and tried to hit the entry point ("/"), and it works: it performs the expected redirect to /home. 现在我部署了我的应用程序并尝试点入入口点(“/”),它可以工作:它执行预期的重定向到/ home。

BUT /home is the problem: I get (in production) an empty (blank) response, and the error log shows: 但/ home是问题:我得到(生产中)一个空(空白)响应,错误日志显示:

[24-Feb-2014 20:14:11] PHP Fatal error: require() [function.require]: Failed opening required '__DIR__/../bootstrap/autoload.php' (include_path= '.:/usr/lib64/php:/usr/share/pear' ) in /home1/centrau9/public_html/index.php on line 21 [2014年2月24日20:14:11] PHP致命错误:require()[function.require]:打开所需的'__DIR__/../bootstrap/autoload.php'失败(include_path = '.:/usr/lib64/php:/usr/share/pear'第21行/home1/centrau9/public_html/index.php '.:/usr/lib64/php:/usr/share/pear'

Note: the file exists, and permissions of /bootstrap/ are 0755, and permissions for autoload.php are 0644. The framework is www-unreachable (ie the public_html corresponds to the "public" directory of the laravel project). 注意:文件存在,/ bootstrap /的权限是0755,autoload.php的权限是0644.框架是www-unreachable(即public_html对应于laravel项目的“public”目录)。

The routes.php file is as follows: 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'));

AND the .htaccess file in public_html is as follows: 和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>

You are probably running PHP 5.2. 您可能正在运行PHP 5.2。 Check your PHP version. 检查您的PHP版本。 You need > 5.3 你需要> 5.3

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM