Move Laravel project to hosting - php

I'm trying to move laravel project to host Virtualmin, I moved all folders in my Document root
HOME/
MYPWD/
APP/
BOOTSTRAP/
CONFIG/
DATABASE/
....
PUBLIC_HTML/
Inside PUBLIC_HTML I have the index.php with these lines:
require __DIR__ . '/../bootstrap/autoload.php';
$app = require_once __DIR__ . '/../bootstrap/app.php';
The login.php page work right, but after login, the browser return an error caused by recursively redirect. In logs I get this error:
exception 'ReflectionException' with message 'Class
App\Http\Middleware\isNotAuth does not exist' in
/home/mypwd/vendor/laravel/framework/src/Illuminate/Container/Container.php:734
I should change something else? Like namespace?
That's my composer.json file:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*",
"doctrine/dbal": "^2.5",
"laravelcollective/html": "^5.2",
"symfony/event-dispatcher": "^3.2",
"psr/log": "^1.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"symfony/css-selector": "2.8.*|3.0.*",
"symfony/dom-crawler": "2.8.*|3.0.*"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan optimize"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist"
}
}
While that's my .gitignore file:
/vendor
/node_modules
/public/storage
Homestead.yaml
Homestead.json
.env

I resolve myself the problem: server linux is case sensitive, so in Kernel.php I called middleware class with IsNotAuth, but filename was isNotAuth

Related

AwsS3Adapter exception appearing locally but not in dev server

I'm working locally on a Laravel project, and suddenly started getting the following exception:
ErrorException in FilesystemManager.php line 193:
Class 'League\Flysystem\AwsS3v3\AwsS3Adapter' not found (View: /Users/mypetproject/resources/views/layouts/topheader.blade.php) (View: /Users/mypetproject/resources/views/layouts/topheader.blade.php) (View: /Users/mypetproject/resources/views/layouts/topheader.blade.php)
A version of this is running on a server without any issue. Just to verify, I checked out the same branch, compared composer.json and composer.lock files and they are the same locally and on the server, did a composer update just in case, and it still fails locally but not in the server. The .env file is also the same.
FilesystemManager is in vender/laravel/framework/src/Illuminate/Filesystem and indeed attempts to use League\Flysystem\AwsS3v3\AwsS3Adapter as S3Adapter; however this is also the case with the version running on the server.
As a note, I'm not using S3 at all, and I don't really want to install league/flysystem-aws-s3-v3 since I'm not using it.
Any idea what could be wrong?
This is my composer.json
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.3.*",
"laravelcollective/html": "5.3.*",
"guzzlehttp/guzzle": "^6.2",
"google/cloud-storage": "1.1.5"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-update-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
},
"minimum-stability": "dev",
"prefer-stable": true
}
I finally tracked it down to the autoload_static.php and autoload_classmap.php files in vendor/composer/
For some reason it was referencing an incorrect file (one previously using S3):
'App\\IsoClasses\\IsoStorage' => __DIR__ . '/../..' . '/app/IsoClasses/IsoStorageS3.php',
updated to
'App\\IsoClasses\\IsoStorage' => __DIR__ . '/../..' . '/app/IsoClasses/IsoStorage.php',
and it now works.
What is weird is that the dev server's files also have this, but it works in the dev server with no problems.

vendor class not found in laravel

I use unisharp file manager in my project. on my local machine everything works fine, but on remote server it throws error [Symfony\Component\Debug\Exception\FatalErrorException] Class 'Unisharp\Laravelfilemanager\LaravelFilemanagerServiceProvider' not found
in config/app.php everything's correct
/*FileMananger*/
Unisharp\Laravelfilemanager\LaravelFilemanagerServiceProvider::class,
Intervention\Image\ImageServiceProvider::class,
/*CKEditor*/
Unisharp\Ckeditor\ServiceProvider::class,
there is directory unisharp in vedor(so all files and directories are there). when i try to run composer install/update i get this error again. so everything in its right place, but laravel doesn't see this class.
comoser.json
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.6.4",
"laravel/framework": "5.3.*",
"maatwebsite/excel": "~2.1.0",
"appzcoder/crud-generator": "^1.2",
"laravelcollective/html": "^5.3",
"lavary/laravel-menu": "dev-master",
"nesbot/carbon": "^1.21",
"laracasts/flash": "^2.0",
"spatie/laravel-medialibrary": "^3.11",
"firebase/php-jwt": "^4.0",
"doctrine/dbal": "^2.5"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.0",
"symfony/css-selector": "3.1.*",
"symfony/dom-crawler": "3.1.*"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
},
"files": [
"app/Http/helpers.php"
]
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-root-package-install": [
"php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan optimize"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist"
}
}
Try to comment those lines in config/app.php and run composer require unisharp/laravel-filemanager again.
You can't set up service providers before they are downloaded through composer.
You need to run:
composer require unisharp/laravel-filemanager
Make sure your config/app.php unisharp providers is matched with the content in folder vendor unisharp composer.json
check below:
Config/app.php
vendor/unisharp-composer.json
the solution is very easy :)
just make sure you have this in your service provider:
Unisharp\Laravelfilemanager\LaravelFilemanagerServiceProvider::class,
not this one:
UniSharp\Laravelfilemanager\LaravelFilemanagerServiceProvider::class,

composer.json file deleted any way to recover it?

i managed to re make my composer.json file
I was working on a project, by mistake, the main composer file was deleted.
cannot recover it manually, I still have vendor folders and files now I cannot add anything else because it will delete the current vendors is there any way to regenerate the composer file with vendors included in it?
now im getting
Whoops, looks like something went wrong.
1/1
FatalErrorException in Controller.php line 27:
Call to undefined function App\Http\Controllers\getcong()
{
"name": "testing/test",
"description": "test",
"keywords": ["test"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
"SocialiteProviders/Manager": "^2.1",
"Simexis/Installer": "^1.6",
"Laravel/Socialite": "^2.0",
"Intervention/Image": "^2.3",
"Illuminate/Html": "^5.0",
"laravel/socialite": "^2.0",
"terbium/db-config": "^2.0",
"laravelcollective/html": "5.*",
"yajra/laravel-datatables-oracle": "^6.21",
"socialiteproviders/vkontakte": "^2.0"
},
"require-dev": {
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1",
"barryvdh/laravel-translation-manager": "0.2.x",
"psy/psysh": "^0.7.2"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"pre-update-cmd": [
],
"post-update-cmd": [
"php artisan clear-compiled",
"php artisan optimize",
"php artisan serve"
],
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
}
}
i believe this is causing the error:
"terbium/db-config": "^2.0",
usage example: getcong('p-news')
thank you.
I need to add
"files": [
"app/Http/helpers.php"
]
to composer file :)

Installation of package.json

i am unable to install this library from GitHub. [Minishlink/web-push]
I have Laravel 5 installed on my server, I want to install this in the Laravel directory (project). And will use the library via custom PHP.
I am facing below issues:
When I run composer require minishlink/web-push, I get below error:
When I run composer require mdanter/eec, I get below error
When I run composer require pargonie/rndom_compat, I get below error
Here is the composer.json file (I have not included the web-push file here as I am using the require command via putty, [Please correct me if I'm wrong])
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
"guzzlehttp/guzzle": "~4.0",
"maatwebsite/excel": "~2.0.0",
"aloha/twilio": "^2.0",
"laravel/socialite": "2.0.*",
"ixudra/curl": "6.*",
"laracasts/utilities": "^2.1"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1",
"laracasts/utilities": "~2.0"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"pre-update-cmd": [
"php artisan clear-compiled"
],
"post-update-cmd": [
"php artisan optimize"
],
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
}
}
This is the same type of issue as #17. It's not related to Minishlink/web-push. One of your dependancies is stuck in the past with paragonie/random_compat v1.1.5. You should check which one and ask the owner to update the composer.json. To fix this temporarily, in your composer.json, on your dev machine put:
"paragonie/random_compat": "dev-master as 1.1.5",
"minishlink/web-push": "^1.1"

Laravel RuntimeException Could not scan for classes inside "database" which does not appear to be a file nor a folder

I am trying to run command
composer update
getting this error message:
[RuntimeException]
Could not scan for classes inside "database" which does not appear to
be a file nor a folder
This is the code inside my composer.json:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*",
"jenssegers/mongodb": "^2.0",
"lucadegasperi/oauth2-server-laravel": "^5.1",
"laravelcollective/html": "5.2.*",
"davibennun/laravel-push-notification": "dev-laravel5"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"symfony/css-selector": "2.8.*|3.0.*",
"symfony/dom-crawler": "2.8.*|3.0.*"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-update-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist"
}
}
We can resolve this issue by create database folder under our project root: <PROJECT_ROOT>/database. If we want to make sure all things are good to use, we can delete composer.lock file and run the composer update command again.

Categories