简体   繁体   中英

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.

I modified the index.php in my public_html and modified my server.php in the laravel folder. is there a step I have missed because I still get a blank page when I run my page.

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

<?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.

If the folder is outside public_html and change paths in 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 . Then in public_html create same folder myproject and place content of public directly in there.

Change permission of app/storage to 775

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM