本文介绍了laravel 5.6主机到cpanel共享主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
主机Laravel 5.6
应用程序如何在共享主机上进行面板显示.
How can a host a Laravel 5.6
app to cpanel on a shared hosting.
有人可以给我一个主意吗
Can someone give me an idea
require __DIR__.'/../vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Turn On The Lights
|--------------------------------------------------------------------------
|
| We need to illuminate PHP development, so let us 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 our users.
|
*/
$app = require_once __DIR__.'/../bootstrap/app.php';
/*
\#########my index.php file
推荐答案
您有两种可用的方法,一种需要ssh访问.在任何情况下,您都不会将整个Laravel目录放入public_html
目录.
You have two methods available, one requiring ssh access. Under no circumstances do you put your entire Laravel directory into the public_html
directory.
如果您具有SSH访问权限,则需要执行以下操作;
If you have SSH access you'll want to do the following;
- 登录您的帐户并转到主目录
cd ~
- 删除
public_html
目录 - 现在您想将Laravel应用上传到
~/laravel
- 现在您需要重新创建public_html作为符号链接
cd ~ && ln -s laravel/public public_html
- Log into your account and go to your home directory
cd ~
- Delete the
public_html
directory - Now you want to upload your Laravel app to
~/laravel
- Now you need to recreate public_html as a symlink
cd ~ && ln -s laravel/public public_html
如果您没有SSH访问权限,则需要执行以下操作;
If you don't have SSH access you'll want to do the following;
- 将您的laravel安装上传到
~/laravel
(在public_html上方) - 将
~/laravel/public
目录的内容复制到public_html
- 更改路径以匹配您的新目的地
- Upload your laravel installation to somewhere like
~/laravel
(above the public_html) - Copy the contents of the
~/laravel/public
directory topublic_html
- Change the path to match your new destination
您的新~/public_html/index.php
应该如下所示;
Your new ~/public_html/index.php
should look like the following;
<?php
/**
* Laravel - A PHP Framework For Web Artisans
*
* @package Laravel
* @author Taylor Otwell <[email protected]>
*/
define('LARAVEL_START', microtime(true));
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| our application. We just need to utilize it! We'll simply require it
| into the script here so that we don't have to worry about manual
| loading any of our classes later on. It feels great to relax.
|
*/
require __DIR__.'/../laravel/vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Turn On The Lights
|--------------------------------------------------------------------------
|
| We need to illuminate PHP development, so let us 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 our users.
|
*/
$app = require_once __DIR__.'/../laravel/bootstrap/app.php';
/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request
| through the kernel, and send the associated response back to
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
|
*/
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);
$response->send();
$kernel->terminate($request, $response);
这篇关于laravel 5.6主机到cpanel共享主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!