Homestead and Laravel basis understanding - laravel

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

Related

How to run laravel artisan command on server?

How to run laravel artisan command on server? I have to run this this command:
composer require realrashid/sweet-alert
If you have access for ssh, login through it.
Check if you have composer by typing composer in terminal else install it.
to Install composer use composer install command in terminal.
go to the root folder in which laravel is installed using cd command.
In the root folder, run the command php artisan in terminal.
It should work fine now.
What if you have Shared hosting?
Just look for terminal in cpanel. See image for ref..
Open it and try for the steps given above.
Thank you!

Run Laravel phpMyAdmin via php artisan serve

I have a Laravel project running with php artisan serve (no Apache or Nginx) on:
http://localhost:8000/
I have then ran this successfully
composer require phpmyadmin/phpmyadmin
My question is, what additions to Laravel's routing etc. must I do to run the following?
http://localhost:8000/phpmyadmin
Though I haven't found a specific way to have
http://localhost:8000/phpmyadmin
working through Laravel as part of php artisan serve, there is a simple solution that works just fine using PHP's native server instead, assuming you have mysql installed as localhost:
composer create-project phpmyadmin/phpmyadmin
cd phpmyadmin
ls -la #files look like classic phpMyAdmin, note however `vendor` folder in place along with package.json
php -S http://localhost:7000 #and you should be able to see and log in!
This does everything I need it to do. If you want to install phpMyAdmin through an actual webserver like Apache that runs always, you're better off doing something like apt-get [or yum] install phpmyadmin and then you'll have a directory override from Apache running:
http://www.mylaravelapp.com/phpmyadmin

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.

symlink(): Protocol error in Vagrant 2.0

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

Laravel installed but confusion remains

I have ubuntu 14.04 and LAMPP is installed. I was learning Laravel 4, but get a lot of confusion on it's documentation, below I list few of issue.
How to install laravel?
what I did :
copy github repository into /opt/lampp/htdocs/larva and run composer install, Laravel is installed and I can access it with http://localhost/larva
What is homestead? is that another way to install laravel or this is additional thing?
What is artisan? if I use artisan then do we need to use homestead also?
what I did ( in terminal )
cd /opt/lampp/htdocs/larva
php artisan serve
it started the service and I can access laravel with htpp://localhost:8000 BUT if i close this terminal then URL is lost
and there is one other way is using vagrant? do we need to use vagrant if we installed it already?
one more thing is Nginx?
overall these vagrant, Nginx, Homestead, artisan,and composer methods create such a mess.
Please clear the clouds and please do not mention what is vagrant Nginx and all. I just want to know that do I need to do something with Homestead and vagrant if i have installed using git repository and composer way?
Thanks
Laravel Homestead is an official, pre-packaged Vagrant "box" that provides you a wonderful development environment without requiring you to install PHP, a web server, and any other server software on your local machine.
Artisan is the name of the command-line interface included with Laravel. It provides a number of helpful commands for your use while developing your application. It is driven by the powerful Symfony Console component.
When you close the terminal, you are stopping the service on port 8000. You always can create a virtual host, and point its root to your larval installation /public directory
you dont have to use vagrant to run laravel. Vagrant is just your 'bridge' to Virtual Mashine.
If you installed LAravel via composer and you got it work on localhost:8000 then you dont need neither homestead or vagrant

Resources