LARAVEL-将我的laravel项目放在000webhost中在线 [英] LARAVEL - Put my laravel project online in 000webhost
问题描述
我已经将公用文件夹中的文件上传到public_html,将其他文件上传到laravel.
i already upload files in the public folder to public_html, and others to laravel.
我也更改了index.php.
i changed index.php too.
但是我什么也没得到....
but i get nothing ....
[
我明白了... 有人可以帮助我吗? 谢谢
I get this... Some one can help me? Thanks
这是我的索引文件,我认为那很好
This is my index file, i think thats is good
<?php
/**
* Laravel - A PHP Framework For Web Artisans
*
* @package Laravel
* @author Taylor Otwell <taylor@laravel.com>
*/
/*
|--------------------------------------------------------------------------
| 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 nice to relax.
|
*/
require __DIR__.'/../laravel/bootstrap/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);
现在我在XAMPP本地有这个
Now i have this locally in XAMPP
推荐答案
这个问题已经很久了,但是其他人可能会觉得这个答案很有用.基本上,您要做的就是将应用程序配置为在新环境中正常运行.
The question is quite old however others may find this answer useful. Basically what you have to do is to configure the App to work properly in the new environment.
-
转到 000webhost cPanel>设置>常规>重置网站.您必须确保站点中没有其他内容,以防止干扰.
Go to 000webhost cPanel > Settings > General > Reset website. You must make sure no other content is present in your site to prevent interference.
以ZIP格式存档您的整个Laravel项目.
Archive your entire Laravel Project in ZIP format.
使用文件管理器将存档上传到000webhost站点到/public_html
.
Upload the archive to 000webhost site to /public_html
using File Manager.
将与package.json
处于同一级别的所有文件/文件夹移动到/
Move all files/folders which are on the same level with package.json
to /
删除/public_html
.您将不再需要它.
Delete /public_html
. You won't need it anymore.
将/public
重命名为/public_html
在register()
方法中转到/app/Providers/AppServiceProvider.php
,并在其中添加以下代码:
Go to /app/Providers/AppServiceProvider.php
at register()
method and append the following code inside it:
$this -> app -> bind('path.public', function()
{
return base_path('public_html');
});
打开/.env
.复制APP_KEY
值不 base64:
转到/config/app.php
,找到'key
',然后将行替换为以下代码:
Go to /config/app.php
, find 'key
' and replace the line with the following code:
'key' => env('APP_KEY', base64_decode('%YOUR_COPIED_APPKEY%'));
如果您的项目已连接到数据库,请从/config/database.php
更新数据库凭据.查找mysql
向量,并正确更新数据库,用户名和密码.
If you have your project connected to a database, update the database credentials from /config/database.php
. Lookup for mysql
vector and update the database, username, password properly.
...这应该可以解决问题.如果您还有其他问题,请在此处编写有关整个过程的教程:
...And this should do the trick. If you have further questions, a tutorial has been written about the entire procedure here: https://www.000webhost.com/forum/t/deploy-laravel-project-into-000webhost-site/127323/
希望这会有所帮助:)
这篇关于LARAVEL-将我的laravel项目放在000webhost中在线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!