[英]Uploading Laravel 4 to shared hosting
I would like to upload my laravel 4 project to the shared, I created a separate laravel folder uploaded all the contents except for the public folder then took all the contents in the public folder and moved them to my public_html folder. 我想将我的laravel 4项目上传到共享,我创建了一个单独的laravel文件夹,上传除公共文件夹之外的所有内容,然后将公共文件夹中的所有内容移动到我的public_html文件夹中。
I modified the index.php in my public_html and modified my server.php in the laravel folder. 我修改了public_html中的index.php并修改了laravel文件夹中的server.php。 is there a step I have missed because I still get a blank page when I run my page.
是否有一个我错过的步骤,因为我在运行页面时仍然会得到一个空白页面。
public_html/index.php 的public_html / index.php文件
<?php
/**
* Laravel - A PHP Framework For Web Artisans
*
* @package Laravel
* @author Taylor Otwell <taylorotwell@gmail.com>
*/
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
| for our application. We just need to utilize it! We'll require it
| into the script here so that we do not have to worry about the
| loading of any our classes "manually". Feels great to relax.
|
*/
require __DIR__.'../laravel/bootstrap/autoload.php';
/*
|--------------------------------------------------------------------------
| Turn On The Lights
|--------------------------------------------------------------------------
|
| We need to illuminate PHP development, so let's turn on the lights.
| This bootstraps the framework and gets it ready for use, then it
| will load up this application so that we can run it and send
| the responses back to the browser and delight these users.
|
*/
$app = require_once __DIR__.'../laravel/bootstrap/start.php';
/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can simply call the run method,
| which will execute the request and send the response back to
| the client's browser allowing them to enjoy the creative
| and wonderful application we have whipped up for them.
|
*/
$app->run();
laravel/server.php laravel / server.php
<?php
$uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$uri = urldecode($uri);
$paths = require __DIR__.'/bootstrap/paths.php';
$requested = $paths['public_html'].$uri;
// This file allows us to emulate Apache's "mod_rewrite" functionality from the
// built-in PHP web server. This provides a convenient way to test a Laravel
// application without having installed a "real" web server software here.
if ($uri !== '/' and file_exists($requested))
{
return false;
}
require_once $paths['public_html'].'/index.php';
Your assistance will be greatly appreciated just started learning laravel. 刚开始学习laravel,将非常感谢您的帮助。
If the folder is outside public_html
and change paths in public/index.php 如果文件夹在
public_html
之外并且在public / index.php中更改路径
//require __DIR__.'/../../bootstrap/autoload.php';
require __DIR__.'/../../myproject/bootstrap/autoload.php';
//$app = require_once __DIR__.'/../../bootstrap/start.php';
$app = require_once __DIR__.'/../../myproject/bootstrap/start.php';
All folders must be outside public_html
for example myproject
. 所有文件夹必须在
public_html
之外,例如myproject
。 Then in public_html
create same folder myproject
and place content of public
directly in there. 然后在
public_html
创建相同的文件夹myproject
并将public
内容直接放在那里。
Change permission of app/storage
to 775
将
app/storage
权限更改为775
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.