Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Add a PHP syntax checker to BBEdit Apps
I'm not too familiar with AppleScript, but I managed to add PHP syntax checking functionality to BBEdit using the following script. If you run the script and there's an error in the active document, it will show you the error and highlight the line with the error. It uses the php binary in /usr -> local -> bin -> php) with parameter -l to do the actual checking.

[robg adds: I've put the text of the script online for download -- bbedit_php.sit. I don't have BBEdit to this with, so if you try it, please post your comments.]
    •    
  • Currently 2.00 / 5
  You rated: 3 / 5 (2 votes cast)
 
[8,697 views]  

Add a PHP syntax checker to BBEdit | 10 comments | Create New Account
Click here to return to the 'Add a PHP syntax checker to BBEdit' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
PHP syntax checker to BBEdit--not working for me
Authored by: MtnBiker on Jun 10, '03 06:54:46PM

This doesn't seem to do anything. I did copy the script as supplied into BBEdit and cleared tabs and resaved as a script to even get it to stay a script when reopened.

I put intentional error in PHP doc and nothing happens. I'm wondering if there is some error in the script as posted. Seemed to extra characters.

---
Hermosa Beach, CA USA



[ Reply to This | # ]
PHP syntax checker to BBEdit--not working for me more info
Authored by: MtnBiker on Jun 10, '03 07:05:07PM

But then I don't have a folder /usr -> local -> bin -> php.

I have files in /usr -> local -> bin, but no php folder. PHP works on may machine as I'm running a server http://KeepTheRubberSideDown.com/ which seems to work.

PHP Version 4.1.2 per phpinfo

---
Hermosa Beach, CA USA



[ Reply to This | # ]
PHP CLI app
Authored by: jecwobble on Jun 11, '03 10:08:43AM
This script (I haven't tried it yet) uses the comman line PHP binary application which, when installed, is typically stored in your /usr/local/bin directory. Your web server is using (I assume) the PHP module for Apache. You won't automatically have the binary just because you have the module. The binary will need to be enable when PHP is made from source.

I have Apples Apache 1.x with Marc Liyanage's PHP module, which doesn't come with the binary version.

I recently installed Apache 2 and PHP 4 from Server Logistics. In the download section for their precompiled PHP 4 module is an optional link to download the PHP binary which, as they claim, only works with their PHP module package. I installed it, too, and it works as advertised from the Terminal.

[ Reply to This | # ]

Add a PHP syntax checker to BBEdit
Authored by: Paul Burney on Jun 10, '03 07:40:15PM

It isn't working for me, I get the following:

"A scripting error has occurred: BBEdit got an error: {line 0 of window 1} doesn't understand the select message."

FWIW, I'm using BBEdit 7 and I do have php in /usr/local/bin. It might have been installed by the developer tools.



[ Reply to This | # ]
Add a PHP syntax checker to BBEdit
Authored by: kfaulhaber on Jun 11, '03 12:02:06AM

For this to work, you must have the command line executable of PHP installed, which is something you have to do intentionally. The MacOS install (and the standard install if you are building from source) is to install an Apache module.



[ Reply to This | # ]
Simple version
Authored by: i5ao on Jun 13, '03 06:37:51PM
Hey all,

Here's my "bare bones" version of the script, if you'll excuse the pun. Tested and works, assuming you have PHP installed, --cli-enable displayed in your phpinfo(); and your php binary is pointed to by the script property phpref.

There's a way to create a BBEdit style search results window with this data; maybe when I get some time.

Cheers,

Isao

bbphplint

property phpref : "/usr/local/php/bin/php -l "
try
  tell application "BBEdit" to get file of first text window
  do shell script phpref & POSIX path of result
  display dialog "Ok: " & result buttons {"finished checking"} default button 1
on error msg
  display dialog "Err: " & msg buttons {"finished checking"} default button 1
end try



[ Reply to This | # ]
Simple version
Authored by: sylvank on Jul 23, '03 12:19:17PM

Isao, thanks for this, it works whereas the original did not for me.



[ Reply to This | # ]
PHP Command Line - Precompiled
Authored by: sylvank on Jul 22, '03 06:25:21PM
A copy of PHP with a .pkg installer is avaiable here:

http://www.somebodydial911.com/geek/cli/



[ Reply to This | # ]
PHP Command Line - Precompiled
Authored by: bluehz on Jul 23, '03 07:44:21AM

I just installed the PHP from Mark Liynage site earlier this week and I have the CLI PHP installed... /usr/local/bin/php

PHP 4.3.0 (cli) (built: Jan 2 2003 18:04:26)
Copyright (c) 1997-2002 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2002 Zend Technologies



[ Reply to This | # ]
Works Great!
Authored by: MorganizeIT on Aug 06, '03 03:49:18PM

I used the link from the comments to download and install the pre-compiled php binary. The applescript pops up an error window telling you the line number when it finds mismatched parenthesis and brackets, as well as missing semi-colons. So far I haven't found other types of errors, but I'm sure to generate one soon and I'll report back! One of the other respondents mentioned that it's possible to have the results come back in a BBEdit style search results window, that would be absolutely amazing... imagine the time saved in debugging. I wish BareBones would jump on it,
-Morg.



[ Reply to This | # ]