Make a Netbeans project that runs on Virtualbox shared folder not upload

Asked

Viewed 535 times

0

I have a Virtualbox running an Ubuntu/Apache/PHP web server. I set the application folder in apache to /var/sf_www/ this is a shared folder with my host machine.

I set up Run Configuration in Netbeans as Remote Web Site, to access the ip of my virtual machine.

Whenever I run the application in Netbeans it uploads the changed files to the application server, but this is not necessary as I edit the files on my local machine, which are shared by the application folder of my web server.

How to make Netbeans run the remote server without uploading files?

2 answers

1

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.

0

  • 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?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.