如何在共享主机上部署 laravel 4.2?
我使用 laravel 4.2.8 开发了一个应用程序,现在我无法部署它.我遵循了这个答案 https://stackoverflow.com/a/16683938/3153380 但它不起作用.我得到一个白屏,并且标题返回 500 Internal Server Error 状态.
I developed an application with laravel 4.2.8 and now I am having trouble deploying it. I followed this answer https://stackoverflow.com/a/16683938/3153380 but its not working. I am getting a white screen and the headers are returning a 500 Internal Server Error status.
我读到 laravel 4.2 在共享主机上设置有点棘手,这是真的吗?我似乎可以找到一个可行的解决方案,所以那些之前部署过 4.2 的人请帮忙.我的文件夹结构如下所示
I read around that laravel 4.2 is a bit tricky to set up on shared hosting is this true? I can seem to find a working solution so those that have deployed 4.2 before please help. My folder structure is like below
根/laravel_base/应用程序/...public_html/站点根目录/资产/包/上传/索引.php...有什么指点吗?
root/ laravel_base/ app/ ... public_html/ siteroot/ assets/ packages/ uploads/ index.php ... Any pointers?
推荐答案
首先确保您的共享主机运行 php
>= v5.4.第二次尝试按照以下步骤操作:
First make sure that your shared host runs php
>= v5.4. Second try to follow this steps:
- 在
public_html/
或www/
之外创建一个文件夹.例如:project/
- 将您的 laravel 应用中的每个文件夹和文件(public 文件夹除外)复制到该
project/
文件夹中 - 将
public/
文件夹的内容复制到您的public_html/
或www/
(.htaccess 也必须在那里) 在 public/中找到 index.php 文件并更改以下路径:
- Create a folder outside your
public_html/
orwww/
. Ex:project/
- Copy every folder and file (except the public folder) from your laravel app into that
project/
folder - Copy the content of
public/
folder into yourpublic_html/
orwww/
(the .htaccess must be there too) Inside public/ locate the index.php file and change the following paths:
一个.autoload.php
require __DIR__.'/../bootstrap/autoload.php';
进入
require __DIR__.'/../project/bootstrap/autoload.php';
B.start.php
$app = require_once __DIR__.'/../bootstrap/start.php';
进入
$app = require_once __DIR__.'/../project/bootstrap/start.php';`
毕竟它应该可以工作.
相关文章