Laravel 5 deployment getting :
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request
My file structure:
|
|-pub -> from laravel folder public
|-my_apps
|- my_first_app -> all other files from laravel project
|- app
|- bootstrap
|- config
|- database
|- resources
|- storage
|- ...
I have set storage folder permission to be:
user::rwx
group::rwx
other::rwx
This is my .htaccess file in directory /pub
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteBase / <-------- I added this line
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
I also change path in \pub\index.php
<?php
//updated path
require __DIR__.'/../my_apps/my_first_app/bootstrap/autoload.php';
//updated path
$app = require_once __DIR__.'/../my_apps/my_first_app/bootstrap/app.php';
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);
$response->send();
$kernel->terminate($request, $response);
PHP on my local machine is PHP 5.6, it is PHP 5.5. I tried to add
AddHandler application/x-httpd-php55 .php
in .htaccess after RewriteEngine On
line.
update
The server runs PHP 5.5.0, so I downgraded my Laravel 5.1 to 5.0, and it works on homestead now.
And I'm following https://medium.com/laravel-news/the-simple-guide-to-deploy-laravel-5-application-on-shared-hosting-1a8d0aee923e#.50q2s8wer for deployment at this moment. Downgrade actually failed when I check version of laravel
Best Answer
Laravel 5.1 requires PHP 5.5.9, per packagist.
Laravel 5.0 has no bound PHP version requirement, per packagist, however anything less than PHP 5.5 is Not A Good Idea.
Since your server runs 5.5.0 (per comment), then I'm guessing you installed this outside of composer. Downgrade your Laravel environment or upgrade your PHP environment. Upgrading PHP is A Good Idea.