7

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?

3
  • can you tell me, what PHP version your Hosting is installed? here are required Items, which are must for Laravel 5.1 link Commented Feb 25, 2016 at 4:18
  • PHP Version 5.4.45.. thanks i knw it Commented Feb 25, 2016 at 4:29
  • I added, requirements as a answer, I am sure, once you update the required items, it will start working Commented Feb 25, 2016 at 4:36

6 Answers 6

11

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.

Sign up to request clarification or add additional context in comments.

Comments

2

For Laravel, these are required, confirm this

PHP >= 5.5.9 OpenSSL PHP Extension PDO PHP Extension Mbstring PHP Extension Tokenizer PHP Extension 

Comments

1

Procedure on how to host your Laravel 5.1.* application on any shared hosting:

  1. Open Filezilla or any of your favorite FTP Client.
  2. Login and get into the home directory of your hosting account.
  3. Create directory called laravel-app or anything that you want inside your shared hosting account home directory.
  4. Copy everything except public directory from your application's root directory inside the newly created folder. In this case laravel-app.
  5. Now copy the contents of public directory in your public_html directory.
  6. Once everything is uploaded, open up 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:

  1. Login to your cPanel account from the browser.
  2. Scroll down way to the bottom where they say select PHP Version. Click on it.
  3. From the dropdown, select PHP 5.5.6 or any of your choice, but it has to be PHP >= 5.5.*
  4. There is a list of PHP Extensions below the dropdown that can be installed. You can leave it as it is or select the extension(s) that you wish to install. For example, if your application has file uploading feature, then you need to install the 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.

Comments

1

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

Comments

0

check these steps:

  1. check .htaccess file on root or subdomain
  2. if move files of public to root => change index.php contents /../ to /
  3. check the php version (on loravel 5+ i used php7.2 and problem solved)
  4. check .env file

1 Comment

Welcome to Stack Overflow! Please note you are answering an old and question. The OP found his own answer. Here is a guide on How to Answer.
0

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 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.