Edit PHP with SciTE

If you edit PHP using SciTE, you should get more productive with it!

You can press F5 to run the current program and get output to a console.

Most web developers do not associate the console with making web pages, but there are gains in your development speed.
No webserver is involved when running the PHP executable as is. No overhead, just what PHP outputs after interpreting your source code.

When you press F5 in SciTE you run PHP with its standard parameters. This might be at odds with your
current host for your current project. Say, the error_reporting setting is way too low, and spouts
meaningless notices at you, slowing down your eye-scanning.

Not acceptable.

What we do is configure the command line that launches the PHP executable from within SciTE. I did that like this:

1. I assume you have already gotten and installed a PHP executable on your machine. Else: Get PHP. There are binaries and installers for Windows.
2. In SciTE, select Options/Open html.properties. This opens the configuration file for HTML and PHP in SciTE.
3. Search (Ctrl-F) for “php -f”, and edit that line. It should be the last chunk of the file, circa line 525.
4. My new line 522 was something like this. I present it here as a long line, and using the plugin that shows PHP (to circumvent the Markdown plugin, which did not like underscores), so you should remove the angular brackets and the ”php” markings. Yeah, and pull it together **on one line** (so that **php** is followed by a space and then **-d**, and then the rest of the line:

command.go.$(file.patterns.php)=php -d “error_reporting=E_ALL & ~E_NOTICE” -f $(FileNameExt)

How did I know what to write in the command line? I did a snippet of research. Or, I just asked the PHP executable itself for pointers.

C:Documents and Settingsolle>php -?
Usage: php [-q] [-h] [-s] [-v] [-i] [-f <file>]
       php <file> [args...]
  -a               Run interactively
  -C               Do not chdir to the script's directory
  -c <path>|<file> Look for php.ini file in this directory
  -n               No php.ini file will be used
  -d foo[=bar]     Define INI entry foo with value 'bar'
  -e               Generate extended information for debugger/profiler
  -f <file>         Parse <file>.  Implies '-q'
  -h               This help
[snipped here for relevance]

Published by Olle Jonsson

Human. Wears glasses and often a smile.