Netbeans + Php7.0 + Apache2 + Debian integration: best practices

2

I was having trouble enabling apache2 to run .php pages.

Then I did the following:

I removed the Directory address from the html folder, so the file was:

Iremovedthehtmlfolderin/var/www/htmlbecauseNetBeanswhentryingtocreateaprojectin.phpdidnotletitwritetothewwwfolderbecauseitwasnotempty.

Ichangedthepermissionofthe/var/wwwfoldertochmod777

Ichangedthe/etc/apache2/sites-enabled/000-default.conffilebyremovingthehtmlfromthe/var/wwwaddress

Now every project I create runs correctly at the localhost / index.php address. Before that I got the message that the index.php file did not exist on that server:

Not Found

The requested URL /html/index.php was not found on this server. Apache / 2.4.25 (Debian) Server at localhost Port 80

In addition, when the html folder existed and it was correctly configured in the files 000-default.conf and apache2.conf with the index.php inside it, it did not work, the same message was not found, but if I removed html from the localhost / html / index.php address, the page ran normally. I have not been able to understand why.

Something tells me that this is not the right way to organize things. Could anyone give their contribution to best practices in this case? How should I properly configure apache2, php7.0 plus NetBeans?

    
asked by anonymous 13.10.2017 / 19:14

1 answer

2

It is not recommended to modify the 000-defult.conf file, If it works with development and the application does not need to be accessed by the network, the correct one would be to use the independent installations of php and mysql, so it would not be necessary to install the apache since through the netbeans terminal you could create a virtual port to test the application, it would be recommended to install apache to test servers or even deploy applications on a local network.

  

NetBeans

  • With NetBeans open open the project, then open the project's index file.
  • Now go to the toolbar and click Open in terminal
  • At the bottom you will see that the terminal is open, and will already be inside the directory.
  • Now log in from root to terminal, just as you do to install packages sudo su
  • Now just create the php virtual server using the following command

    php -S localhost:8080

  • Now just go to the browser and type link and you will be accessing the project via the browser, remembering that port 8080 I used by own choice but can be any one since it is not being used by another process.

    The advantage of using the terminal within netbeans is the convenience of installing packages and managerial content like NODE , BOWER , GULP , ETC ...

    This is the way I've been working and sharing with colleagues, but there are several other ways.

        
    13.10.2017 / 19:41