Problem with formatting PHP code within VsCode - php

I am running Windows 10 latest version and VsCode latest version. I'm setting up a website using a PHP framework. Natively there seems no formatting support for PHP so I turned to plugins. I tried 'Format HTML in PHP' and that does exactly what it says - a page of HTML in a file with a .php extension is formatted on save. However when I try to format say a Controller, either on save or by pressing Alt-Shift-F, absolutely nothing happens. I have tried installing 'PHPfmt', 'PHP Intelephense, and 'Prettier' but in each case any attempt to format the Controller (Alt-Shift-F) failed to change anything. Yes I did restart the editor in every case. Can anyone suggest why this is not working or a plugin better than the ones I have tried? Is 'Format HTML in PHP' incompatible with the other plugins? I have really spent a long time on this and got nowhere.

Related

php file problem error showing by vscode extension named php intellisense

enter image description here
I have been facing this problem for a long time while using the extension for the PHP file, I always see this error about some kind of deprecation, didn't find any solution yet, it's very annoying actually.
tried solving by:
reinstalling vscode
uninstall then install the extension again,
while used in other IDE, it works just fine
the file works but, don't know what's the error

Brackets live preview with php file

I discovered the editor "brackets" yesterday and tried to get it working. Now I have some trouble with the live preview, which does not seem to cooperate with php files.
I opened my folder, selected the index.php and when I clicked on live preview it requested for a base url (I am running brackets version 1.7 on windows 8.1 if this is of any relevance). I have also read some instructions about this problem here, but it all leads to the consequence that it isn't possible to actually use live preview but only local servers with php files. Does anyone perhaps have a solution for this?
Most of the instructions I read are already a little bit old so perhaps it is somehow possible now (preferably without needing a local server). I have heard so many positive things about the editor, I am actually really eager to use it.
Going with a local solution for now

phpinfo() returns blank page in Firefox and asks whether to open or save in IE

I'm trying to update a site that's using php. I built the site and tested it on this machine. But today, the Php won't run on my local machine.
To test, I went back to the most basic php page I have:
<?php
phpinfo();
?>
When I navigate to this file, in Firefox (28), the result is a blank page. (The page source shows just my code.) In IE 11, I'm asking whether I want to open or save the file.
Searching for my original problem (which was that my php code was showing up rather than running), it was suggested that php wasn't installed. I don't know how it would have gotten uninstalled, but I went ahead and installed it again (from http://www.microsoft.com/web/platform/phponwindows.aspx) and still no joy.
Windows 7 SP1
Updates in response to suggestions:
Pardon the beginning stuff, but I'm not primarily a web developer. (I do databases.) This is stuff I'm doing for an organization I'm involved in. I don't actually remember having installed/configured a web server in the first place, nor do I remember having installed php before yesterday (though maybe my son did that for me).
After seeing the replies here, I followed the instructions on this page: http://webmasterjuice.com/how-to-activate-built-in-web-server-windows, but I'm still seeing the same thing.
Update:
I've confirmed that IIS is running and the php was installed. I've followed instructions I found online for getting php working in Windows 7 with IIS. However, it still doesn't make sense to me to have to do this. I'm sure I didn't do any of this when I started working with php. I'm not trying to use my computer as a web server. No interest in working through localhost.
I'm creating the file in a simple web-oriented editor (Crimson Editor). Until recently, I could use the editor's preview function on a file, whether HTML or PHP, and it would run correctly. I'm baffled as to why this stopped working.
A few things to look for:
It's php running besides been installed? (obvious, but maybe it got killed by some reason)
Have you included the phpinfo() call inside a html document?
Obviously you named the file with a .php extension and saved it within the document root of the server..?

error messages in eclipse IDE when opening .php and .tpl files

Been using eclipse for a short while. I run ubuntu 10.10 and have installed Eclipse web tools platform plug-ins for ecplise and the php development tools plug-in, when I started a php project I also installed the php perspective, but this doesn't work when I run php files?!
I get this error
Unsupported content type in editor
So when I edit php files I use the Java perspective. This works. I can't say that eclipse impress much with all these weird errors when I install every thing by default and are only doing simple tasks, like editing a php file with a php editor..
I also get this error when I open .tpl files (smarty template engine files)
Could not open the editor: The editor
class could not be instantiated. This
usually indicates a missing no-arg
constructor or that the editor's class
name was mistyped in plugin.xml.
Thats my main problem.
I had the same error namely: Unsupported content type in editor
And solved it this way: You need to open it in navigator (window -> show view -> navigator) not the php perspective or project view or anything else.
At least this worked for me hope it also helps you!
After doing the file association,You need go to preference general > content type > Text and add extension For example , I need *.tpl to be open in HTML editor, than I can do like below.
This seems to be related to your JRE installation.
See those two forum threads:
http://forum.gentleware.com/viewtopic.php?t=4113
http://www.anddev.org/eclipse_fails_to_load_editors_sometimes-t3156.html
Quote:
Reasons could be manifold.
Most popular: You're running Apollo
for Eclipse with JRE version < 1.5.
Look for a line saying
java.vm.version=xxx in Help->About
Eclipse SDK->Configuration Details

When synchronizing in eclipse pdt - getting a blank gray window when comparing versions of a php file

I've installed Eclipse PDT Helios SR1 GTK for 64bit Linux (Ubuntu Maverick clean install).
I added the Subversive plugin for using Subversion, and installed the SVNKit 1.3.2 connector.
I'm using Sun's java and not the OpenJDK version.
When I synchronize a php project, and double click a php file for comparing the differences I made compared to the base revision - it opens a window of a compared file, but the window is empty - I see the gray background as if no file is opened.
When I open files which are not set as a PHP file, it works fine.
(If I'll take a file with a .module extension and define it as a php file in the Content Types preferences pane, it will act badly as described above. If I'll remove this definition, it will work [as if I compared a plain text file]).
Anybody has any idea why is this happening ?
If I missed any important information that will help diagnose or solve this issue, lemme know and I'll add it.
Thank you.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=326194
There's a fix that you can install, although it's on a non-release update site.
Unbelievably, they still haven't fixed it in the main update site.

Categories