Is there a PHP syntax checker plugin for Notepad++?

Please don't answer "Use another editor instead"

share|improve this question
    
Do you mean syntax highlighting? – Oded Jun 10 '11 at 21:01
    
Yes there is, did you save your file in html or php? – Ibu Jun 10 '11 at 21:02
2  
@Oded, I don't mean syntax highlighting. I mean that a list of syntax errors is shown (if any). Similar to sourceforge.net/projects/jslintnpp ... but should show PHP errors, not JS – edt Jun 10 '11 at 21:13
up vote 10 down vote accepted

Try NppExec plugin for Notepad++. Using it create a command to be something like this:

cmd.exe /K c:\your\path\to\php.exe -l "YOUR_FULL_FILE_NAME"

Instead of YOUR_FULL_FILE_NAME you should use appropriate Notepadd++ macro -- I think it is $(FULL_CURRENT_PATH) but double check with NppExec manual (installs together with plugin).

P.S. But any IDE will be better for sure (I'm using PhpStorm). If IDE is too heavy for your PC then look for php-oriented editors, like Blumentals RapidPHP etc (it's lighter than full IDE but may have all really important features).

share|improve this answer
4  
You can do this in the Run menu, you don't need NPPExec installed. – Mr_Chimp Nov 2 '11 at 14:14
1  
Like Mr_Chimp said, you can use Notepad++'s run command. Here is the exact syntax I used after downloading the Windows PHP binaries from php.net and copying them into e:\depot-tools: cmd.exe /K "E:\depot_tools\php-5.4.45\php.exe -l $(FULL_CURRENT_PATH)" – Dave S Apr 20 '17 at 1:34

Adding to @LazyOne's answer: I don't like NetBeans, it's too strict, has a tough time finding includes, and it's slow. I dig N++ for its speed and simplicity. I have php installed on my PC really just to run validation. If you're using N++ (or any other text editor) you can use the following Powershell script to batch check all of the files you've downloaded and are working on. Just fire up Powershell ISE, enter the correct path to check and PHP.exe path for your environment and the results get output to the ISE console.

cls
$pathToCheck = "C:\Users\BigDaddy\AppData\Local\Temp\fz3temp-1"
$phpExePath = "C:\PHP\php.exe"

Get-ChildItem $pathToCheck -Filter "*.php" | foreach {
$pinfo = New-Object System.Diagnostics.ProcessStartInfo
$pinfo.FileName = $phpExePath
$pinfo.Arguments = "-l", $_.FullName
$pinfo.RedirectStandardError = $true
$pinfo.RedirectStandardOutput = $true
$pinfo.UseShellExecute = $false
$p = New-Object System.Diagnostics.Process
$p.StartInfo = $pinfo
$p.Start() | Out-Null
$p.WaitForExit()
$output = $p.StandardOutput.ReadToEnd()
$output += $p.StandardError.ReadToEnd()
$output
}

I hope someone else finds this as useful as I have.

Cheers!

share|improve this answer

I use Komodo Edit 7 (free version) which has a built-in php syntax checker. I dunno how robust it is, but it works fine for me. I’m not a pro web designer, but I like it better then Eclipse and Bluefish. Komodo is smaller than Eclipse and more stable than Bluefish (in my Win XP environment).

share|improve this answer
    
notepad ++ is the best and the fastest editor for advanced users.you can also try php designer it is also good. i dont like other editors. – Ravikant Upadhyay Aug 4 '13 at 3:50

As LazyOne said above, you can use NppExec which you can install using the plugin manager (Plugins>Plugin Manager>Show Plugin Manager) You'll also need to have PHP installed. Lastly, the command I use to do PHP syntax checking with NppExec is

"C:\Program Files (x86)\PHP\php.exe" -l $(FULL_CURRENT_PATH)
share|improve this answer

I recommend you find a true IDE (not a glorified text editor). I've used Notepad++ for years but it can't do much beyond syntax highlighting.

I personally use PHPStorm (but it's not free, it is very good though :D ). You could also use NetBeans or Eclipse.

share|improve this answer
    
I also use NetBeans and Eclipse. But, my computer is too slow. So, Notepad++ is the winner. Real solution is to get a better computer. – edt Jun 10 '11 at 21:16
    
PHPStorm is very fast. A lot faster than Eclipse or NetBeans, which is why I use it. Sure you incur some loss when opening a project but if you learn the hotkeys it's sooo fast. I totally love ctrl+shift+n and ctrl+shift+f is actually super fast. – Halcyon Jun 10 '11 at 21:55
1  
What about a non-commercial IDE? – Cyclone Jun 10 '11 at 22:25
1  
A good non-commercial IDE? That's an oxymoron don't you think? ;) – Halcyon Jun 10 '11 at 22:27
3  
I tried php storm, net beans, zend studio... but i love notepad++ more than anything . because of its speed and lightness. i hope i find a good and light ide ... – h0mayun Apr 5 '15 at 12:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.