我在共享HostGator服務器上部署了Laravel 4應用程序。Laravel 4 HostGator上的內部服務器錯誤500
當我瀏覽到:
http://mydomain.com/laravel/public/
我可以看到Laravel閃屏。
但是當我嘗試訪問任何其他途徑,比如,/用戶/或帖子我越來越
Internal Server Error 500
http://mydomain.com/laravel/public/posts
控制器:
public function index()
{
$posts = $this->post->all();
return View::make('posts.index', compact('posts'));
}
在routes.php文件:
Route::resource('posts', 'PostsController');
我使用Jeffrey Way的Generator來支撐職位實體。
同樣在我的本地機器上正常工作。控制器不包含任何邏輯,它們只輸出提取的數據。
錯誤日誌爲空。
任何想法要檢查什麼? .htaccess,也許? 這裏是我有:
AddType application/x-httpd-php53 .php
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule^index.php [L]
</IfModule>
沒有服務器日誌的500錯誤肯定是.htaccess。它也可能會丟失諸如PDO或mcrypt之類的php擴展(通常只有隱藏纔會出現這種情況)如果php抑制錯誤 - 我不認爲Laravel會這樣做)。嘗試將index.php文件添加到URL中,然後刪除您的htaccess文件以測試htaccess文件是否是問題。 – fideloper
你是對的@fideloper,刪除一切從的.htaccess除非該指令使用PHP 5.3,使應用程序的工作: 將AddType應用/的X的httpd-php53 .PHP 當然,現在的URL必須包括的index.php 在我的情況:mydomain.com/laravel/public/index.php/posts 所以,現在我知道.htaccess導致的問題,任何人都可以提出修復它? –
我在這裏找到了解決方案:http://stackoverflow.com/a/16116678/385402 –