Laravel Homestead Serve code not creating and connecting to folder(s) - php

I have tried running the following code, and even though it runs and sets the nginx blocks ok, its not linking to the folder in question with in the host machine.
serve projects.dev /home/vagrant/Code/projects.dev
When i then list the folders within the Code folder on the guest machine, i only get the folders that were created via the automated Yaml config file on init set up.
It seems not be creating the folder and/or linking to it at all with between the guest and host machines
Running it on a iMac OS Mavericks.
Vagrant 1.6.2
VirtualBox 4.3.12

That is strange. What I have is I have a folder mapped on the "folders" section from my host machine that inside contains all the sub-folders for all my projects in progress. So my nginx sites just basically link to the sub-folders inside this directory. If you have something like that it "should" show you the folders from your host inside that Code directory in your VM. Maybe post your YAML file to check it out?

My problem was the new Homestead file, use small c for spelling directory "code".
I was upgrading my homestead, so the old code folder was using capital c, spelled "Code".
I just change my Homeastead.yaml file from calling "code" to "Code".

Related

Why does my Notepadqq editor does not recognize LAMP www folder and sub-folders?

Attempting to get LAMP working on my 32-bit Ubuntu 18.04 machine. I believe the set-up is close to correct. I have all Apache2, mysql, and PHP software installed. I have an index.php file located in folder /var/www/bookcorner directory which shows up as it should if I enter localhost/index.php in the browser address bar. This file may be edited in nano while saving the changes. However, I cannot use my editor Notepadqq (or presumably others) to edit the file.
Going through the file manager, I can select the file and open it in Notepadqq, but I cannot save it. I get the error, "folder does not exist". If I try a 'Save As' with Notepadqq, I do not see any folders past /var in the directory structure, though they obviously exist. The www folder and subfolders do not show up in Notepadqq.
There are three folders under /var/www which are
bookcorner
html
michaelsbookcorner.com
I have ownership of all of these folders
michaelsbookcorner.com is a live site at Infinityfree.net
I somehow got Apache2 to point to bookcorner for now which is fine. Eventually I would like to select between different websites but I only have one for now existing in another directory. I wish to begin utilizing LAMP rather than uploading PHP files to my hosting site all the time.
What settings/permissions/etc could I have missed here in order to get this working properly?

Laravel 8.60.0 creates a file instead of a folder/symlink when I run `php artisan storage:link`

So , I am working on a small project where I need to create a symlink to store file in the storage directory in laravel. I was previously working on windows where the same code was working fine but as I configured Laravel Sail and set it up in my WSL-2 environment, I performed my ritualistic tasks of setting up the config, creating symbolic link, I am noticing a weird behavior of running the php artisan storage:link command where it creates a file instead of a folder in my app/public folder.
It should be a clickable folder or if not clickable, atleast my IDE should show it as a directory like that of others, i.e. like public, bootstrap, database folders. Is that a problem with my WSL or some internal configuration of Laravel. On double clicking this link it shows:
Any assistance will be greatly appreciated.
If you created it in wsl2, windows won't regonize it as a symlink, it's a unix symlink and not a windows "symlink" that's all.
In WSL you're working inside a unix based filesystem and sharing your filesystem with windows.
Its because your file its just accessible in the docker container created by sail. You cant access to it like this.
note: this is not an error or missing. it is just a behavior
In my case the happened in Ubuntu since I had to connect my storage/app/public folder to public/storage. at first glance, I was confused, and seemed to be an error but with some more try and fail it was correct as it is. the problem was, in Windows all our files existed in a symlink to the public/storage folder and from there we could delete and manipulate the file but after creating the file symlink all files are only visible in storage/app/public directory but can access from public/storage folder from the web easily.
As a work around, created folder manually and run the command.
sail php artisan storage:link.
It will link

Laravel Homestead problems (Windows 10)

I've combed through similar threads, but none are quite the same issue. I've installed Homestead a handful of times now and seem to always have some kind of issue.
So I've created a www folder on my desktop and cloned the laravel/homsetead in there. I "cd" into www/Homestead and run "bash init.sh" but it created the .homestead hidden folder containing Homestead.yaml, after.sh, and aliases file in my Windows "Users" directory. I can copy/past the files into www/Homestead, edit the Homestead.yaml file accordingly, but then I get a slew of errors when I do vagrant up. Any idea why the init shell file points to that directory and how that could be effecting things?
I resolved this by cloning laravel/homestead in my user directory and adding a /Code folder. init.sh ran fine and vagrant up worked without issue.??????
NONO,it doesn't work for me

php url and folder name

I just installed the latest MAMP on Mac, and found this hard to understand:
The document root seems to be "~/MAMP/htdocs", because "localhost" will open the index.php file under this folder.
However, "localhost/MAMP/?language=English" opens "~/MAMP/bin/mamp/index.php". I know that in URL strings between "/"s are not necessaries folders, but if they are not folders, how was it constructed and how does the system know where to find the right files?
I know this is a pretty basic question which I can probably get answers by myself, but I don't know what key word to search. Tried "php url construction" and "php url folder" but no luck. So a proper keyword suggestion is also appreciated.
It is setup by default by MAMP. If you open up MAMP/conf/apache/httpd.conf in a text editor and scroll down to around line 368/369 and specifically line 408 you will see that it is an Apache Alias. it is setup for easy navigation, instead of having to type http://localhost:8888/bin/mamp you can just type http://localhost:8888/MAMP. It is also setup as an Alias to ensure that you can still access the web tools if you change the document root from something other than /Applications/MAMP/htdocs.
Are you sure http://localhost:8888 has the docroot set to ~/MAMP/htdocs as you suggest? Reason I ask is that looking at your first image the text says the docroot is /Applications/MAMP/htdocs. Also the docs say it should be in the /Applications/MAMP/htdocs. I think the issue is that you do not have MAMP in the Applications folder where it needs to be.
https://www.mamp.info/en/documentation/
Where should I store my HTML and PHP pages?
By default, PHP and HTML Pages should be stored inside the MAMP
"htdocs" folder which is located in the MAMP Application directory
/Applications/MAMP. This folder is called "Document Root". You can
change the path for the Document Root in the MAMP application's
Preferences Panel:
Also please note this https://www.mamp.info/en/documentation/#q8
Will MAMP work if the MAMP folder is not located in the Applications
directory?
No. In order to work properly the MAMP folder has to be located in the
Applications folder.

php+nginx+vagrant - php fails to write

I have a vagrant box setup running my dev code which is a nginx/php setup.
(Quick info on vagrant - its a virtualbox wrapper: http://www.vagrantup.com/).
In the vagrant/virtualbox setup, it is using linux guest additions to mount a shared folder on my host computer (MAC OSX).
linux guest path: /var/www/local
OSX host path: ~/src/
On multiple occasions, I find that php can't seem to write anything through any command (file_put_contents, fwrite.. etc) to any path location on the mounted shared folder, However it is able to write outside of the /var/www/local (for example /var/www/not-mounted/..).
I find this very difficult to work with, as I am using a cache system and it keeps failing to write any of the cache javascript/css files to (/var/www/local/public/root/cache/) which I need to be in the root folder of my website which is (/var/www/local/public/root/index.php).
I have done a lot of research on this topic:
it seems, the folder mount has the right permissions:
When I type mount command in the linux guest, I get this:
/var/www/local on /var/www/local/ type vboxsf (uid=1000,gid=1000,rw)
Clarify:
This happens all the time, it is a known problem I encounter which I try to workaround.
From cat /etc/passwd:
vagrant:x:1000:1000:vagrant,,,:/home/vagrant:/bin/bash
Can anyone help me on this?
I have figured out the problem.
I have forgot to give PHP the correct user-privileges and permissions to write to the folder. Basically, my PHP user/user-group was www-data/www-data however, vagrant has its own user/group (vagrant/vagrant) which mounts the folder /local/.
Since I did not want to mess with my vagrant mounting behaviour, I just simply changed my php config to start PHP with the user/group - vagrant/vagrant.
This fixed the issue for me.
Thanks for the help!

Categories