I am ;D
I also work a lot with WordPress, I use the standard Homestead box. Really easy to setup. I just added a sites directory for my WordPress projects.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi,
I have been using MAMP for my PHP development but now that I'm trying out Laravel using Vagrant, VirtualBox and Homestead I was wondering if It was common to use this setup environment for all of your PHP projects.
Are you using your virtual machine for all of your PHP projects or only Laravel? If you are also using it for plain PHP projects, could please describe the setup you using? I'm more curious about what box you are using, are you using Homestead or what other box you use for your PHP projects.
Thanks
I am ;D
I also work a lot with WordPress, I use the standard Homestead box. Really easy to setup. I just added a sites directory for my WordPress projects.
Yes I do too, anything I do now that I used to use MAMP for I now use Homestead. It doesn't make sense to use anything else once you have a virtual machine set up.
Previously to that I was using Vagrant and Vaprobash but since I now use Forge, it makes sense to go all in!
Yup me too. WordPress, Codeigniter, Modx, Laravel and custom PHP stuff all on Homestead 2
The only minor issue I've encountered is due to Nginx not reading .htaccess files so some rules need to be entered into the site config file.
The other great thing I love about Vagrant is Vagrant Share which is a really easy way to share the project with the outside world.
Thank you all for the good information. Make sense, I guess I just need to get more familiar with the environment.
Question.
When you create your directory for you PHP projects (other than Laravel) do the projects need to live in a folder called "public" ? The reason for this question is because apparently in Laravel all of the public pages need to go under the "public" folder.
Looking at the code below, Is this how you would map a directory for your PHP development? Going back to the above question and to clearify my confusion about the "public" folder. Do I need to have "public" as part of the URL in the sites: section? Does this have any relation with the "public" folder in Laravel projects?
folders:
- map: ~/my-php-projects
to: /home/vagrant/my-php-projects
sites:
- map: myphpprojects.app
# do I need the public folder in the line below? If yes, why?
to: /home/vagrant/my-php-projects/public
Thanks
No they don't, that is just a convention for Laravel and other frameworks.
The Homestead.yaml file is just a mapping from a domain to a directory. Nothing more. You can point the domain to any folder you wish.
Thanks. How about the URL in the sites: section, can someone explain why include public in the URL?
sites:
- map: myphpprojects.app
# do I need the public folder in the line below? If yes, why?
to: /home/vagrant/my-php-projects/public
Thanks
@fsdolphin, the sites config is what maps the hostname to the path when you provision the box. The "to:" is anywhere you have the files stored that you want to load using the "map:" aka hostname.
Here is an example of my Homestead.yaml file
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Development
to: /home/vagrant/Development
sites:
- map: wordpress.app
to: /home/vagrant/Development/WordPress
- map: dmca.app
to: /home/vagrant/Development/dmca/public
- map: laravel.app
to: /home/vagrant/Development/laravel/public
databases:
- homestead
- wordpress
variables:
- key: APP_ENV
value: local
Thank you all very much for your help!
I use both at the same time. Homestead for bigger projects, AMPPS for the many smaller ones. That last one (comparable to MAMP) is just easier and quicker to set up sites, in my opinion. Don't need the command line to do simple stuff or manually writing to yaml files, I can just go to the AMPPS control panel and click I want a new site, give a name, and be done. PhpMyAdmin is included already, etc.
I have more then 50 sites in my AMMPS setup. If I would have them all in a Homestead box and something goes wrong with that box and I need to rebuild the homestead box, I will loose all 50 databases. Or have to backup and reimport them all. Too much work.
@robgeorgeuk I got some issues trying to get modx running on homestead. Basically i get the modx 500 error. I am suspecting i need to config it somehow, i just haven't figured it out yet. Did it work out of the box for you?
@Will I think I tweaked the location section of my Nginx config file like the below.
location / {
root "/home/vagrant/Code/mywebsite/public";
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?q=$1 last;
}
#try_files $uri $uri/ /index.php?$query_string;
}
Thanks @robgeorgeuk , i will have a look at that today. Hopfeully it works:) Otherwise, do you have a contact email? It would benefit my structure to have it all under homestead for would be interested to buy time from you if i cant get it sorted.
Hi @bobbybouwmann,
If I follow your homestead.yaml, which folder should I have my WordPress and my Laravel development under yea?
Laravel == /development/laravel/public? WordPress == /development/WordPress?
@leokoo Yeah just the regular directory for WordPress sites since they will start with the index.php file in the root of the project. Laravel projects have the index.php file in the public directory.
thanks @bobbybouwmann !
I'm a bit lost here @bobbybouwmann and the rest.
`ip: "192.168.10.10" memory: 2048 cpus: 1 provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys: - ~/.ssh/id_rsa
folders: - map: ~/Code to: /home/vagrant/Code
sites: - map: wordpress.dev to: /home/vagrant/Code/WordPress - map: php1.dev to: /home/vagrant/Code/php1 - map: homestead.dev to: /home/vagrant/Code/Laravel/public
databases: - homestead - wordpress`
The 3 folders on ~/Code https://monosnap.com/file/y5pLPvCIoeq1CCWW1gXPksS9jhdeDS
Within the php1 folder https://monosnap.com/file/K43robg86bhqpkaZIRAnpJ97758MUv
Modified the hosts file https://monosnap.com/file/VSa59hx0x9REFnSj7jk4wCL7wvkzbp
No input file specified https://monosnap.com/file/0t2b4pfBC5tPey3a9Lfs1F1pZ2xXzE
Any thoughts on why it isn't working?
Looks fine to me. Did you provision your homestead environment?
homestead provision
// or
vagrant reload --provision
Thanks @bobbybouwmann, I finally got it to work when I did the following based on the following article
$ vagrant global-status $ vagrant provision 2a6e97d
http://stackoverflow.com/questions/30577469/no-input-file-specified-laravel-homestead
However, I found if I called homestead, it instead shows vagrant. As such, I can't type in "homestead edit" and edit the homestead.yaml automatically. Any thoughts?
Here's a screenshot
Have any of you ever gotten the friendly URL's to work whilst running a modx dev environment?
Please or to participate in this conversation.