在托管服务器上使用 PHP 5.6 托管 Laravel 4.2 项目 500 内部服务器错误

Hosting a Laravel 4.2 project with PHP 5.6 on a hosting server 500 Internal Server Error

/vendor/laravel/framework/src/Illuminate/Support/helpers.php on line 411

上述错误是我在使用 PHP 5.3

的免费托管服务上遇到的

我也在尝试使用 PHP 5.3 的另一项付费服务​​,但我遇到了 500 内部服务器错误,我确保我的路由和路径正常运行。 (public 文件夹中的 index.php/bootstrap/path.php 文件很适合使用 DIR URI。

现在我确定我会不断收到此类错误,除非我将其托管在 PHP 5.6 的服务上,否则我的应用程序将无法运行,但我希望有一种方法可以我可以降级我的 Laravel 版本或 PHP 版本以获得某种 Backward Compatibility.

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, cgiadmin@yourhostingaccount.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

我的文件在根目录下,没有public_html文件夹,所以原来在Laravel/public文件夹里的文件分散在根目录下,我的其他应用文件和文件夹在根目录下的文件夹中。

如有任何建议或帮助,我们将不胜感激。

Laravel 4.2 要求 PHP 5.4.

Laravel 4.2 requires PHP 5.4 or greater. This upgraded PHP requirement allows us to use new PHP features such as traits to provide more expressive interfaces for tools like Laravel Cashier. PHP 5.4 also brings significant speed and performance improvements over PHP 5.3.

请参阅此以获取更多信息:http://laravel.com/docs/4.2/releases

您的问题很不清楚,因为您首先声明在使用 PHP 5.6 时出现 500 内部服务器错误(在标题和标签中),但随后您说“[ PHP 5.6".

除非 [you] 将其托管在服务上,否则] 应用程序将无法运行

我通过编辑服务器 /public_html 文件夹中的 .htaccess 文件解决了这个问题。

通过使用 cPanelRedirects 并将其重定向到

domain.com/{if it's inside a folder inside the public_html}/index.php

然后 所有路由和链接都有效 非常好。

如果您想更改 URL 并使用 Pretty URLs,请参阅 Laravel 文档Configuration.