D. Lopes
D. Lopes

Reputation: 119

LARAVEL - Put my laravel project online in 000webhost

i already upload files in the public folder to public_html, and others to laravel.

i changed index.php too.

but i get nothing ....

[What s[][1][1]

enter image description here

enter image description here

I get this... Some one can help me? Thanks

EDIT: This is my index file, i think thats is good

<?php

/**
 * Laravel - A PHP Framework For Web Artisans
 *
 * @package  Laravel
 * @author   Taylor Otwell <[email protected]>
 */

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

EDIT: Now i have this locally in XAMPP enter image description here

Upvotes: 3

Views: 13622

Answers (2)

user8555937
user8555937

Reputation: 2387

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.

  1. Go to 000webhost cPanel > Settings > General > Reset website. You must make sure no other content is present in your site to prevent interference.

  2. Archive your entire Laravel Project in ZIP format.

  3. Upload the archive to 000webhost site to /public_html using File Manager.

  4. Move all files/folders which are on the same level with package.json to /

  5. Delete /public_html. You won't need it anymore.

  6. Rename /public to /public_html

  7. 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'); });

  8. Open /.env. Copy APP_KEY value without base64:

  9. Go to /config/app.php, find 'key' and replace the line with the following code:

    'key' => env('APP_KEY', base64_decode('%YOUR_COPIED_APPKEY%'));

  10. 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/

Hope this helps :)

Upvotes: 1

Tamil
Tamil

Reputation: 391

WRITE YOUR index.php

$app->bind('path.public', function() {

       return __DIR__ ; 

});

Upvotes: 0

Related Questions