Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php laravel 5.6共享主机上的主机到cpanel_Php_Jquery_Laravel - Fatal编程技术网

Php laravel 5.6共享主机上的主机到cpanel

Php laravel 5.6共享主机上的主机到cpanel,php,jquery,laravel,Php,Jquery,Laravel,如何在共享主机上将应用程序托管到cpanel 有人能给我一个主意吗 require __DIR__.'/../vendor/autoload.php'; /* |-------------------------------------------------------------------------- | Turn On The Lights |-----------------------------------------------------------------------

如何在共享主机上将应用程序托管到cpanel

有人能给我一个主意吗

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\u html
目录

SSH访问 如果您具有SSH访问权限,则需要执行以下操作:

<?php

/**
 * Laravel - A PHP Framework For Web Artisans
 *
 * @package  Laravel
 * @author   Taylor Otwell <taylor@laravel.com>
 */

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);
  • 登录您的帐户并转到您的主目录
    cd~
  • 删除
    public\u html
    目录
  • 现在您想将您的Laravel应用程序上载到
    ~/Laravel
  • 现在,您需要将public_html重新创建为符号链接
    cd~&&ln-s laravel/public_html
没有SSH访问 如果您没有SSH访问权限,则需要执行以下操作:

<?php

/**
 * Laravel - A PHP Framework For Web Artisans
 *
 * @package  Laravel
 * @author   Taylor Otwell <taylor@laravel.com>
 */

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安装上传到类似于
    ~/laravel
    (公共html上方)的地方
  • ~/laravel/public
    目录的内容复制到
    public\u html
  • 更改路径以匹配新目标
新的
~/public\u html/index.php
应该如下所示:

<?php

/**
 * Laravel - A PHP Framework For Web Artisans
 *
 * @package  Laravel
 * @author   Taylor Otwell <taylor@laravel.com>
 */

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);

在谷歌搜索之后,我发现您必须获取包含index.php文件的公用文件夹的内容,并将其放入public\u html中。现在我们必须更改index.php文件的内容,即只提供app.php和autoload.php的正确链接,即
require\uuuuu DIR\uuuu.//vendor/autoload.php'
$app=require\uu once\uuuu DIR.//bootstrap/app.php'
同时更新你的.env文件并检查它是否正常。如果没有,你必须使用
php artisan cache:clear
php artisan route:clear
清除缓存和路由。如果你的共享托管团队非常支持你,你可以使用ssh或在web.php中定义函数,然后点击链接, 将您的文件上载到public_html文件夹,如果您没有ssh访问服务器的权限,请联系您的托管团队,让他们将您的域名作为根文件夹指向public_html/public文件夹。 然后让他们通过ssh执行以下命令

composer install
如果您想提高性能,请向他们提供以下文章中列出的四个命令


嗯。共享主机不支持php 7,larave 5.6依赖于php 7。你们找到解决办法了吗。我在bluehost上使用Laravel4.x已经有好几个月了

Laravel5.6
需要
PHP7

首先在Cpanel(PHP选择器)中检查您的共享托管支持
PHP7
,如果是,但您有其他项目
PHP5
,并且您不想更改默认的PHP版本,那么请在
.htaccess
文件中使用此项

例如:public\u html/abc/.htaccess

RewriteEngine on
AddHandler application/x-httpd-php71 .php
然后
PHP7
工作,您可以在共享主机上使用
Laravel5.6

laravel -> all laravel file

public_html -> move all folder & file on *public* file laravel to *public_html*

change your index.php on public html
require __DIR__.'/../laravel/vendor/autoload.php';
$app = require_once __DIR__.'/../laravel/bootstrap/app.php';

不要忘记将php版本更改为7.2,这是在共享主机上托管的最简单方法

laravel -> all laravel file

public_html -> move all folder & file on *public* file laravel to *public_html*

change your index.php on public html
require __DIR__.'/../laravel/vendor/autoload.php';
$app = require_once __DIR__.'/../laravel/bootstrap/app.php';
  • 在主机上创建子域并将其映射到文件夹,例如:“abc”
  • 在文件夹“abc”中上载laravel项目zip(带有供应商文件夹),然后将其解压缩
  • 将子域映射到laravel的公用文件夹,即“abc/public”
  • 创建一个数据库&user,并将该用户以所有权限分配给数据库(&U)
  • 在上面创建的数据库中导入数据库转储
  • 在laravel.env文件中添加DB用户/密码

  • 注意:如果您因缓存而面临任何问题,请删除目录bootstrap/cache中的config.php文件。

    代码片段的意义是什么?我刚刚尝试了SSH方法,结果导致
    ln:无法创建符号链接“public\u html/public”:没有这样的文件或目录
    @Hiroki请确保先删除
    public\u html
    ,然后做
    ln-s~/laravel/public~/public\uhtml
    共享主机支持您想要的各种配置