I just finished setting up database into the cpanel and uploaded the project into the cpanel. I zipped the project and uploaded that way. I moved all the files from ‘public’ folder into the public_html and the rest into a new directory called ‘house’ and after that I edited the index.php file as follows
require __DIR__.'/../house/vendor/autoload.php';
$app = require_once __DIR__.'/../house/bootstrap/app.php';
Still the website is inaccessible. I must be missing something from the beginning. In firefox, the page is blank and google chrome says This page isn’t working. Do I have to change the .env and database.php inside config? I have followed all the instruction shown in some of the helpful videos but nothing seem to work for me.
My current .env file has following lines (no credential set up)
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
3
Answers
May be this will help you,
Change your server.php file
to,
Copy everything into public_html from public folder and change path to
Note: I advise you to leave everything as it is including the .htaccess file
Compress the entire project folder on your local machine. You’ll get a zip file – laravel50.zip
Open your shared hosting cPanel.
Click on ‘File Manager’
Click on ‘Upload’
Upload the laravelproject.zip to the root directory – not the public_html
Extract the laravelproject.zip to file manager
Open the laravel50 folder and MOVE the CONTENTS of the public folder to your cpanel’s public_html folder. You can as well delete the empty public folder now.
Navigate to the public_html folder and locate the index.php file. Right click on it and select Code Edit from the menu.
This will open up another tab showing the cpanel code editor.
change the following lines (22 and 36) from
require __DIR__.'/../bootstrap/autoload.php';
...
$app = require_once __DIR__.'/../bootstrap/app.php';
to
require __DIR__.'/../laravel50/bootstrap/autoload.php';
...
$app = require_once __DIR__.'/../laravel50/bootstrap/app.php';
the .htaccess file should look something like this.
Options -MultiViews