Netbeans + Php7.0 + Apache2 + Debian : Best Practices

Asked

Viewed 201 times

2

Was having trouble enabling apache2 to run . php pages.

Then I did the following:

I removed from the Directory address the html folder, so was the file: inserir a descrição da imagem aqui

I removed the html folder in /var/www/html because Netbeans when trying to create a project in . php it wouldn’t let it be written to the www folder because it wasn’t empty.

I changed the permission of the /var/www folder to chmod 777

I changed the /etc/apache2/sites-enabled/000-default.conf file by removing the html from the /var/www address

inserir a descrição da imagem aqui

Now every project I create runs correctly on the localhost/index.php address. Before that I received 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

What’s more, when the html folder existed and it was correctly configured in the 000-default.conf and apache2.conf files with index.php inside it, it didn’t work, the same message wasn’t found, but if I removed html from the localhost/html/index.php address, the page rotated normally. I couldn’t understand until now why.

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

1 answer

2


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

Netbeans

  1. Open the project with Netbeans, then open the project index file.
  2. Now go to the bar tools and click on Open in the terminal
  3. At the bottom you will see that the terminal will be open, and will already be inside the directory.
  4. Now log in from root to terminal in the same way you do to install packages sudo su
  5. Now just create the php virtual server using the following command

    php -S localhost:8080

Now just go in the browser and type http://localhost:8080 and will already be accessing the project via browser, remembering that the port 8080 I used by own choice but can be any one as long as it is not being used by another process.

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

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

Browser other questions tagged

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