I have laravel homestead running on a windows 10 machine.
From an Admin CMD or Git Bash prompt when i run the following from the project root folder on local machine:
ln -sr storage/app/public public/storage
A storage directory is created but when i ssh into virtual machine it is highlighted as blue with a green background meaning its a normal directory and not a symlink - symlinks are highlighted as blue in ubuntu.
I know its not working because when I add a file into storage/app/public it does not appear in public/storage
Please note running vagrant ssh into project and running php artisan storage:link gives input/output error hence using the above method
Any ideas why this is happening?
Related
I have deployed my laravel application on shared hosting. I have moved all my filed and folders from public directory to public_html.
This is my directory structure
my-laravel-folder
public_html
index.php
Now i am trying to create symlink in public_html using command php artisan storage:link. but this command create symlink in public directory.
what should i do to create symlink in public_html using command php artisan storage:link ?
You can follow below steps to create a symlink
First go to root directory of file system by running this command
cd /
Then run this command
ln -s /path-to/my-laravel-folder/storage/app/public /path-to/public_html/storage
I faced the same problem on Hostinger and I was able to fix this by running the following command in the root directory.
ln -s /home/MY_USERNAME/domains/MY-DOMAIN.COM/my-laravel-folder/storage/app/public /home/MY_USERNAME/domains/MY-DOMAIN.COM/public_html/storage
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
When I SSH into homestead, I no longer need to prepend my artisan commands with php. ie. I can write, for example
artisan -h
rather than
php artisan -h
But on my local machine, I always have to first issue the command through php. How is it that this is not necessary within homestead, and is there a way to replicate this behaviour on my local machine. I am running Windows 7.
The answer really depends on what OS you're running locally. On macOS / Linux, you can edit (or create) a .bash_aliases file in your user folder and add the line:
alias artisan='php artisan'
You can see this in action by running the following command in homestead:
nano ~/.bash_aliases
First off: I'm very familiar with Composer and also Symfony and some other MVC frameworks.
I tried the following installation documentation, but I'm stuck on how to properly install a laravel project as "apache:apache" under "/var/www/html" on a CentOS 6 virtual machine.
I ran the composer global require "laravel/installer" command, and it says to put "~/.composer/vendor/bin" in your PATH. So I presume this command (laravel install) is done as a normal user (not root), and the folder will exist in your home directory when run.
I added to my path by editing my /etc/profile to include this. But when I try to run laravel new laraveltest in the /var/www/html folder (owned by apache), I get:
[abunk#Alvin-CentOS6 html]$ laravel new laraveltest
Crafting application...
PHP Warning: file_put_contents(/var/www/html/laravel_572e877d514bacbb7381860b8307a067.zip): failed to open stream: Permission denied in /tmp/.composer/vendor/laravel/installer/src/NewCommand.php on line 122
PHP Warning: ZipArchive::extractTo(): Permission denied in /tmp/.composer/vendor/laravel/installer/src/NewCommand.php on line 140
PHP Warning: ZipArchive::close(): Invalid or uninitialized Zip object in /tmp/.composer/vendor/laravel/installer/src/NewCommand.php on line 142
Composer could not find a composer.json file in /var/www/html
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Application ready! Build something amazing.
So then I copied the folder /home/abunk/.composer to /tmp/.composer; and then I ran su -s /bin/sh apache -c "laravel new laraveltest" from the /var/www/html folder (this should run as apache).
But instead I get this:
[abunk#Alvin-CentOS6 html]$ su -s /bin/sh apache -c "laravel new laraveltest"
Password:
Crafting application...
PHP Warning: proc_open(/dev/tty): failed to open stream: No such device or address in /tmp/.composer/vendor/symfony/process/Process.php on line 290
[Symfony\Component\Process\Exception\RuntimeException]
Unable to launch a new process.
new [--dev] [--] []
So my question is (or maybe this is really a bug): How do install as the apache user? Any recommendations?
I could do this as root user, but I think it's a bad idea to run Composer as root user.
I successfully installed the latest Laravel framework on my Centos 7 VHost.
After the composer command was done installing it, I created a new Laravel project.
For that I went o /var/www/ and created a folder there called "great" , then I changed directory to enter it, so pwd showed me
/var/www/great/
Then I ran this command:
composer create-project laravel/laravel myproject
The last one, created (as expected) a new folder inside the "great" folder called "myproject"
According to the Laravel installation instructions, I changed my directory to be inside the myproject folder and when I run
php artisan -V
I get:
Laravel Framework version 5.0.16
then I ran the command
php artisan serve --host 192.168.1.60 --port 80
with 192.168.1.60 being my vhost's IP address. So i expect to be able to see the Laravel page from my other computer (windows) when I access the ip in my browser, but it's not happening. All I get in my browser is:
ERR_CONNECTION_TIMED_OUT
At first I tried it without specifying the host or the port... same result. Then I discovered that I need to specify the host in order to be able to access the project from locations other than localhost. So I tried accessing it by going for http://192.168.1.60:8000 (because that is it's default port). Same result.
I can ping the IP, on Centos side I do not get any error when I run the artisan serve....
What am I doing wrong?