To do this, go to your virtual machine settings and create a shared folder.
Settings dialog > Shared Folders
In this example name the shared folder as "Server". In the options leave marked only "Make permanent".
Now run the virtual machine and install the additional virtualbox programs on linux
Devices > CD/DVD Devices > VBoxGuestAdditions.iso
Mount the CD with the command
sudo mount /dev/cdrom /cdrom
run the command below to download some packages needed for installing the virtualbox tools
sudo apt-get install build-essential linux-headers-`uname –r`
Soon after we go to the installation of the tools
Para 32bit: sudo /cdrom/VBoxLinuxAddition-x86.run
Para 64bit: sudo /cdrom/VBoxLinuxAddition-amd64.run
Restart the machine
sudo reboot
So you don’t have to work to change or create virtualhosts in apache, build your shared folder in /var/www
sudo mount -t vboxsf -o rw,uid=33,gid=33 Server /var/www;
Pay attention to the part uid=33,gid=33
this represents the user code and the group apache runs in. Normally www-data
. Change if apache is configured to use another user, otherwise you will have problems with permission to run your scripts.
So you don’t have to mount your shared folder every time you start the virtual machine, add a startup script.
cd /etc/init.d/
sudo vi sharedfolder.sh
paste the code below into the file and save by pressing ESC
> :wq
> ENTER
#!/bin/bash
sudo mount -t vboxsf -o rw,uid=33,gid=33 Server /var/www;
Now you can allow Netbeans to run your projects directly from a local folder. So it won’t upload the project.
To configure Xdebug on the virtual machine and enable Netbeans to run debug normally change the Xdebug settings on php.ini
as follows
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host={IP da maquina virtual}
xdebug.remote_port=9000
xdebug.remote_autostart=0
Ready, environment set up.
Even if this link is a good suggestion, this reply will not be valid if one day the link ceases to work. So, because it’s important for the community to have content right here, you’d better respond with more complete answers. Can you elaborate more your answer? A summary of the content of the link would help a lot! Learn more on this item in our Community FAQ: Answers that only contain links are good?
– Maniero