symlink(): Protocol error in Vagrant 2.0 - laravel

I am new to Homestead and Laravel, recently I have installed Vagrant 2.0.0 in my Windows 10 PC. I have successfully installed Laravel 5.5 however there is an error of [ErrorException] symlink(): Protocol error. I have tried to solve this using
Laravel 5.3 storage:link -> symlink(): Protocol error
https://laracasts.com/discuss/channels/servers/creating-symbolic-link-on-homestead
But still, the solutions mentioned there seems to be not solving the issue. I can't either run Git Bash & CMD in admin mode, as it gives error while running vagrant up command.
Can anyone please give a solution for this?
Thanks in Advance
Barun

I solved the problem
Create these folders under storage/framework:
sessions
views
cache
then run terminal in administrator
Vagrant up
php artisan cache:clear
php artisan config:clear
php artisan view:clear
php artisan storage:link
refresh the page without cache.

I solved mine by running bash as an Admin.
Things to notice:
If you are using a virtual box and you run bash as an Admin, this will expect that the OS/BOX is saved in the Admin state of your virtual box as well. If not, once you vagrant up, it will redownload the OS/BOX again because it is going to save now in the Admin environments. Sorry for bad English. Hope you get what I mean...

This may help, if you have previously renamed a folder in the virtual machine there may be an old VBoxInternal2/SharedFoldersEnableSymlinksCreate entry. If a bad entry exists then you will receive the protocol error. To remove the bad entries:
VBoxManage getextradata {name of virtual machine}
Review the list of VBoxInternal2/SharedFoldersEnableSymlinksCreate entries and for each one that is no longer valid:
VBoxManage setextradata {name of virtual machine} VBoxInternal2/SharedFoldersEnableSymlinksCreate/{bad entry}
Running this without a value at the end will remove the entry. You can confirm this by running the getextradata command once more.
Then reload your vagrant box. This resolved this issue for me.

You must do the below steps:
you have sart git-bash as administrator
then go to the Homstead folder mostly->
cd: c:/users/username/homestead
then type->
vagrant ssh Homestead will open
now you navigate to your app mein folder in example:
cd: f:/homestead-projects /example-app
now you have to run the artisan comands:
php artisan cache:clear
php artisan config:clear
php artisan view:clear
php artisan storage:link
The Storage folder will be created at APP->public->storage here you see now folder created by uploading files

Related

Laravel 8 permission denied in shared hosting

I have my laravel 8 app hosted in hostinger hpanel but for hours I have trying to fix this error.
UnexpectedValueException There is no existing directory at "There is no existing directory at "/Users/macbookpro/Documents/Theodory/projectName/storage/logs" and it could not be created: Permission denied" and it could not be created: Permission denied missing folder is from my machine instead of cpanel path.
I have tried find and delete ../bootstrap/cache/config.php but there is no such a file and I have tried to delete all storage/logs but am still getting that error and I have tried to add manually in web.php
Route::get('/optimize',function(){
Artisan::class('optimize:clear');
});
But when I hit /optimize am still getting the same error.
I have decided to use hostinger ssh so that I can be able to run artisan commands but am still getting same error even after hitting artisan commands successful.
What can I make it work in hostinger hpanel to which is similar to traditional cpanel.
try the following commands and hit again /optimize
php artisan route:clear
php artisan config:clear
php artisan cache:clear
try these artisan commands
php artisan optimize:clear
after that, you should run this command
php artisan optimize
you are facing this issue because your application doesn't have proper permissions for the storage directory.
Use this command to grant required permissions to the storage directory, and this should resolve the issue.
chmod 777 -R storage/

Laravel: Ran artisan commands and now can't connect

I am working on the frontend for a friend's Laravel app and some of the Blade views got cached. After I ran the following code, I can't even connect to the localhost:
php artisan view:clear
php artisan cache:clear
php artisan config:cache
The site is running on Docker containers, so I even tried to restart them but still nothing but it comes up with a PHP error screen that says:
InvalidArgumentException in FileViewFinder.php line 137:
View [errors.no-store] not found.
So is it because I cleared the views?
It does not work when your machine is running on vagrant (or another virtual environment like docker) and you run php artisan config:cache out of vagrant. Do you need to run this command in vagrant? The problem is about path routes (path are not the same in vagrant and out of vagrant).
The same thing is with Docker. If there is a project in directory outside of container in shared location php artisan config:cache has to be run from within container.
Please refer to this answer.

Downloaded laravel project hangs on preloader when deployed on localhost

I'm trying to deploy a laravel project I have received onto my localhost but it hangs on the loading page and doesn't load the site.
I received the source code of a laravel project that was coded for me.
The deployed website on the shared hosting works properly, and I can also manipulate the files through my ftp access.
However, I'm trying to deploy the project on my localhost (as well as to migrate to a different shared hosting service).
I tried loading the server on wamp, homestead and with artisan serve, but all methods end up the same - the index.php seems to be loading, but is stuck eternally on the preloading .gif file and doesn't present the site.
the browser debugger is throwing a lot of javascript errors (see attached image)
I assume a have a config problem, but I can't locate it and I am unsure how to even locate & debug the issue.
I tried following these configuration steps:
1. changed .htaccess to generic laravel .htaccess (deleted cpanel related lines)
2. changed the .env to fit my wamp db / homestead db
3. composer install
4. composer update
5. php artisan key:generate
6. php artisan cache:clear
7. php artisan migrate
I also installed laravel-debugbar but it hasn't helped me out of the box, and I'm unsure where I need to try to catch the problem.
If anyone can give me pointers on how to understand my problem better, I would be very thankful.
Thanks in advance!
laravel bug
Double check your .env if all details are correct
Set APP_DEBUG=true in your .env file
Double check if your database exist and have data if you are using a database
Check if your host is added to /etc/hosts
Check if your host is added to apache/nginx config correctly
Try running these commands:
$ rm composer.lock package-lock.json
$ composer install
$ npm install
$ npm run dev
$ php artisan clear-compiled
$ php artisan optimize:clear
$ php artisan package:discover
$ php artisan storage:link
$ php artisan migrate:fresh && php artisan db:seed // optional!
Then clear browser cache to be safe.
Open web inspector to see if you can see any errors.
Open latest laravel log in storage/logs/ folder to debug.
If all fails, install laravel-debugbar and see if you can debug there.

laravel cache failed to open stream: No such file or directory framework/views

I use laravel 5.4. a clear cache after update config file. that appear like this error.
ErrorException in Filesystem.php line 111:
file_put_contents(/home/web_user/webhosts/mufer/backend.mufer.local/storage/framework/views/318a49f22562be3fc1c86c88ecc141c22e`8fed4e.php): failed to open stream: No such file or directory`
Then i try to fixed using following command:
php artisan route:cache
php artisan view:clear
php artisan config:cache
and:
file_put_content...fail to open stream:Permission denied in Laravel 5
Some answer are said craete /storage/framework sub folders and then composer update. but that also not working.
screen shot
Then i run composer dump-autoload
andcomposer update`.
But problem not solved..
Perhaps you are using Homestead?
I ran into this problem when using Homestead. Basically, when you are using Homestead and run the php artisan config:cache command out of your virtual machine, the cache paths get broken.
I solved it login via ssh to Homestead vagrant ssh and running php artisan config:cache from there.
My solution was to chmod /storage/framework/views directory to 777.
I had this same problem and my mistake was so simple it's hilarious.
I forgot to git add one of my files. So on the backend, it was trying to get this file.php but it didn't exist. It's usually quite descriptive in the error, except, I was running a job that jumps on a queue. All of a sudden, that helpful exception no longer exists :D
So in order to fix it, I had to:
git add -A
git commit -m "blah blah"
git push
On the server, I needed to:
git pull
composer dump-autoload
It's worked for me gently:
php artisan view:cache

Homestead and Laravel basis understanding

I have some questions about the basis understanding about homestead and laravel.
I have set up my homestead with this guide: https://laravel.com/docs/5.2/homestead and it works ok.
1) But when I vagrant ssh into my box, I can call composer, but I can't call laravel or php artisan. Have I done something wrong/misunderstod something?
2) Do I need to install php and laravel locally, can't I just run it on my VM like i do now?
To call php artisan commands (after you ran vagrant ssh command) you need to have installed Laravel project and you need to be in project's root folder:
cd my-laravel-project
php artisan

Resources