How to use PHP in Vscode?

Asked

Viewed 11,899 times

0

Good afternoon! I used the PHP Storm IDE for programming in PHP, and it allows connection to a remote server and execution of code there on the server. Now, I migrated to VS Code and would like to know how I can program in PHP in this IDE. Where do I insert the remote server data? How do I run a script? Thank you!

Ps: I already installed some extensions like PHP Intellisense and PHP Debug, but still don’t know what to do.

Ps2: I use Locaweb server, this PHP programming would be for a web page.

  • 1

    Keep in mind that not all programs have the same tools. Phpstorm is an IDE, while VS Code is text editor with some plus. Make sure first that VS Code is able to do what you want. By the way, why PHP Storm apparently met your needs?

  • Yes, I have already researched and it is possible to use PHP in VS Code (so much so that there are numerous extensions to facilitate this process), but I did not find anything about how to actually encode and upload the code on the server (after all, that’s why I’m here asking the question). And I stopped using PHP Storm for the greater convenience of VS Code (search a little about the pros of this tool), and VS Code is totally free, unlike PHP Storm.

  • I don’t know exactly how it would work for you, but for example with Git, when you commit it sends the changed file straight to the repository, ai suffice you to refresh the page that it already takes what has been changed etc. Then VS Code communicates yes with remote directories, you have to see how you will send the file to your server, a way as I said is configuring Git there, or maybe with Docker, but then I don’t have the knowledge to give much opinion.

  • I think that whoever marked this issue as bad did not bother to understand that this is valid from the moment someone wants to use. @Lucasvicente, I would like some help from you, I installed the plugins, but for some reason I keep getting some errors. You could contact me directly?

1 answer

3


Vscode is not an IDE like Phpstorm, so you don’t natively have how to put server data and other facilities that Phpstorm natively gave you.

What I do is to have my Vscode with the most recommended PHP extensions installed, so just open the editor and go to the sidebar in the extensions part, in the search type: @recommended php.

Then you can use the integrated Vscode terminal (through the hot key or through the command tab ctrl + shift + p typing "Open new terminal". From there you can develop normally, it is possible to use the native PHP server with php -S in the terminal itself, after all PHP is only a text file that is interpreted in the browser.

There are other extensions like the ones below to make it a little easier:

If you use git Vscode already has the git native extension, if not you can search for other extensions with FTP to access the server.

Browser other questions tagged

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