How to solve Error500 Http\Kernel::class on Laravel 5 - laravel

Hi I have to install finished project created by laravel5 on my client'cloud (CentOS). Everything work find on my windows local host. But I got error500 on real server.
Some error clue:
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture());
$response->send();
$kernel->terminate($request, $response);
This phpmyadmin screen sent from my client
Note that this is cloud server that is not my own. So I can not install composer / run command or install other libraries. Thank you for all answer.

You have to change the vendor and bootstrap folder path in index.php on your current structure
change these two lines from index.php
require __DIR__.'/../vendor/autoload.php';
$app = require_once __DIR__.'/../bootstrap/app.php';
to
require __DIR__.'/vendor/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';

Related

/vendor/autoload.php error while running laravel

so im new to laravel, just downloaded composer, created new project through terminal in vscode, tried to run it and this error shows up
Error in localhost>public
The Code:
require_once __DIR__ . '/vendor/autoload.php';
and also getting errors while compiling on these:
$response = $kernel->handle(
$request = Request::capture() //Undefined type 'Illuminate\Http\Request'//
)->send();
the illuminate code:
use Illuminate\Http\Request;
Help would be appreciated
You should have following code for autoload.php. Basically, you're trying to look for vendor directory in the public folder, whereas it is normally placed in the base directory
require __DIR__.'/../vendor/autoload.php';
Did you try running a composer update command?
Re-installed everything in the same (C) directory and its working great now
Appreciate the help, thank you, everyone!

Move Laravel project to subdomain where Wordpress is already installed

I created a subdomain and move whole project except public folder. Create mysql database and upload my database there. Now, in public_html folder I already have wp files so I created new folder there which I named same as subdomain. So, subdomain is something.something.com and now I have path public_html/something/public where I upload all from public folder. I try to rename files in index.php public foder:
require __DIR__ . '/../bootstrap/autoload.php';
$app = require_once __DIR__ . '/../bootstrap/app.php';
to this:
require __DIR__ . '/../something/public/bootstrap/autoload.php';
$app = require_once __DIR__ . '/../something/public/bootstrap/app.php';
but still I get this:
And I edit .env file to find database. Where am I wrong?
Solved! It was PHP version mismatched. In local it was 7.1 but on server was 5. When I update on server it worked.

upload Laravel in subfolder

I have uploaded my public items in public_html/demo
other folders to /home/danior/source/
/home/danior/public_html/demo/index.php:
require __DIR__.'/../../source/vendor/autoload.php';
$app = require_once __DIR__.'/../../source/bootstrap/app.php';
/home/danior/source/server.php:
require_once __DIR__.'/../public_html/demo/index.php';
http://danior.ir/demo/
but there some unknown errors !
filesystem.php won't upload
I upload my projects like this, hope it will help-
Create a sub-domain/domain eg- demo
Upload public folder items in your sub-domain "demo".
Create another folder inside public_html eg- demo_support.
Compress rest of the files as xyz.tar and upload and decompress in public_html/demo_support and configure your .env according to you.
Now in your public_html/demo/index.php -
replace
require __DIR__.'/../bootstrap/autoload.php';
with
require __DIR__.'/../demo_support/bootstrap/autoload.php';
and
replace
$app = require_once __DIR__.'/../bootstrap/app.php';
with
$app = require_once __DIR__.'/../demo_support/bootstrap/app.php';

Accessing php files out of root folder(Laravel)

Inside my Magento Project folder I want to install laravel so that I can access Mage from laravel. Directory structure is following
Magento(root)
--laravel
--app
...
...
How can I achieve That? Or suggest any other way so that I can access magento from laravel like following.
require_once ('../app/Mage.php');
Mage::app();
Mage::getSingleton('core/session', array('name' => 'frontend'));
$collection = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('*');
UPDATE
Controller Location relative to magento
D:\xampp\htdocs\magento\custom\app\controllers\ProductsController.php
Make sure the path is correct, it should work.
Use this one
require_once (realpath(dirname(__FILE__) . '/../app/Mage.php'));
Your path ( require_once ('../app/Mage.php'); ) is not correct that's why you are facing this issue.Except this logic wise your code is correct.
If you are running your code from somefile.php in laravel then it should work.
Magento(root)
--laravel
|__somefile.php
--app
...
...
I have used dirname() function to solve this problem.
require_once (dirname(dirname(dirname(dirname(realpath(__FILE__))))).'/app/Mage.php');
I don't think this the nice or smart way, but it works. Thanks.
Maybe someone useful:
require_once (dirname(dirname(dirname(dirname(realpath(__FILE__))))).'/../app/Mage.php');
\Mage::app();
$blocks = \Mage::getModel('cms/block')->getCollection();
foreach ($blocks as $block) {
echo $block->getTitle()."<br>";
}

Laravel url without public folder

hi i am using wampserver for my project
and my project is in folder sss
so i must type this Url localhost\sss\public
and want to have this
localhost\sss\
to show my index page
Copy the public folder contents outside the public folder and open index.php which you copied outside the folder, than change the:
require __DIR__.'/../bootstrap/autoload.php';
$app = require_once __DIR__.'/../bootstrap/start.php';
to
require __DIR__.'/bootstrap/autoload.php';
$app = require_once __DIR__.'/bootstrap/start.php';
and you can access directly.

Resources