Laravel 4内部服务器错误500 HostGator的 [英] Laravel 4 Internal Server Error 500 on Hostgator
问题描述
我有一个Laravel 4的应用程序部署的共享HostGator的服务器上。
当我浏览到:
http://mydomain.com/laravel/public/
我可以看到Laravel启动画面。
但是当我尝试访问任何其他途径,比如,/用户或/职位我正在
内部服务器错误500
http://mydomain.com/laravel/public/posts
控制器:
公共功能指数()
{
$帖= $这个 - >后>所有的();
返回查看::彩妆('posts.index',紧凑的('帖子'));
}
在routes.php文件:
路线::资源('帖子','PostsController');
我用杰弗里方式的发电机脚手架职位实体。
罚款我的本地机器相同的作品。控制器不包含任何逻辑,它们只输出所取出的数据。
错误日志是空的。
任何想法是什么检查? htaccess的,也许? 下面是我有:
将AddType应用/的X的httpd-php53的.php
< IfModule mod_rewrite.c>
选项-MultiViews
RewriteEngine叙述上
的RewriteCond%{} REQUEST_FILENAME!-d
的RewriteCond%{} REQUEST_FILENAME!-f
重写规则^的index.php [L]
< / IfModule>
正如评论,一个500错误,而不从应用程序记录相应的日志文件条目可能是一个.htaccess文件的问题。
由于OP中发现的问题与重写(而不是指令使用PHP 5.3):
由于这可能是上HostGator的一个共同的问题,您应该检查在他们的帮助文档。
不过,我在修复第一个尝试是添加一个的RewriteBase 指令
的RewriteBase /
因此,这将是这样的:
< IfModule mod_rewrite.c>
选项-MultiViews
RewriteEngine叙述上
的RewriteBase /
的RewriteCond%{} REQUEST_FILENAME!-d
的RewriteCond%{} REQUEST_FILENAME!-f
重写规则^的index.php [L]
< / IfModule>
请注意,这里假设你正在运行Web应用程序构成了Web根,而不是一个子目录。
I have a Laravel 4 app deployed on shared Hostgator server.
When I navigate to:
http://mydomain.com/laravel/public/
I can see the Laravel splash screen.
but when I try to access any other route to, say, /users or /posts I am getting
Internal Server Error 500
http://mydomain.com/laravel/public/posts
Controller:
public function index()
{
$posts = $this->post->all();
return View::make('posts.index', compact('posts'));
}
In Routes.php:
Route::resource('posts', 'PostsController');
I use Jeffrey Way's Generator to scaffold the posts entity.
The same works fine on my local machine. Controllers don't contain any logic, they only output the fetched data.
Error logs are empty.
Any ideas what to check? .htaccess, maybe? Here is what I have there:
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>
As mentioned in comments, a 500 error without a corresponding log file entry from the application logger is likely an .htaccess file issue.
Since the OP found the issue is related to the rewrite (and not the directive to use php 5.3):
Since this is probably a common issue on Hostgator, you should check with their help docs.
However, my first stab at a fix would be to add a RewriteBase directive:
RewriteBase /
So it would look like:
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
Note that this assumes you're running the web application form the web root and not a sub-directory.
这篇关于Laravel 4内部服务器错误500 HostGator的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!