Reputation: 472
I'm hosting laravel 5.1 in my cpanel but it always accured error.I tried every method (htaccess, chmod 644 and storage give o r+W) but it doesn't work in my cpanel but when i removed following line from index.php of public folder it give access to index.php file:
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);
$response->send();
$kernel->terminate($request, $response);
so it give access to mine folder . Can anybody help me? can it cause due to php version of cpanel?
Upvotes: 7
Views: 42561
Reputation: 170
By following one of the above answer I wrote this code in start of index.php file of public folder (public/index.php
):
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);
After reloading site, I saw the issues were coming from vendor folder. Means composer folder is not updated yet. I ran these commands in Terminal of CPANEL:
cd laravelfolder //public_html or your code root directory
composer update
Upvotes: 0
Reputation: 507
Paste this code at the top of your index.php file which will be in the public folder:
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);
Then visit the URL of your project and there you will see the issue because which laravel is throwing this error.
Upvotes: 11
Reputation: 1
check these steps:
Upvotes: 0
Reputation: 472
Thank to all.. i solved it .. in cpanel there is php selector. so i changed it 5.6 and uploads all the folder of vender than give right permission to ech folder and files..
Upvotes: 1
Reputation: 4020
Procedure on how to host your Laravel 5.1.* application on any shared hosting:
laravel-app
or anything that you want inside your shared hosting account home directory.public
directory from your application's root directory inside the newly created folder. In this case laravel-app
.public
directory in your public_html
directory.index.php
file which resides in public_html
directory in any of your favorite text editor.Change the following line:
require __DIR__.'/../bootstrap/autoload.php';
to
require __DIR__.'/../../laravel-app/bootstrap/autoload.php';
And also change the following line:
$app = require_once __DIR__.'/../bootstrap/app.php';
to
$app = require_once __DIR__.'/../../laravel-app/bootstrap/app.php';
Before Uploading:
Please make sure that you have enabled all the plugins that are required by Laravel application. And also you are using PHP >= 5.5.* . If you don't know how to view which plugins are enabled by default.
Follow these steps:
fileinfo
extension by check marking that extension and clicking the button Save
.DONE. Your Laravel application is live on a shared hosting account.
You can check it by going to yourdomain.com
Hope this helps you. Happy Coding. Cheers.
Upvotes: 1
Reputation: 5135
For Laravel, these are required, confirm this
PHP >= 5.5.9
OpenSSL PHP Extension
PDO PHP Extension
Mbstring PHP Extension
Tokenizer PHP Extension
Upvotes: 2