Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
 
Python and Tcl - public course schedule [here]
Private courses on your site - see [here]
Please ask about maintenance training for Perl, PHP, Lua, etc
 
Compile but do not run PHP - syntax check only

The -l option to PHP on the command line compiles but does not run the code in the file - so it's very useful for syntax checking your code.

Here's an example where I tested a file with a deliberate mistake:

-bash-3.2$ php -l wsse.php
Parse error: syntax error,
unexpected '{', expecting '(' in wsse.php on line 11
Errors parsing wsse.php
-bash-3.2$


And here's the results once I have corrected that:

-bash-3.2$ php -l wsse.php
No syntax errors detected in wsse.php
-bash-3.2$


A woundThe -l is the letter "l" - it stands for "lint". Lint was originally a program that was used in conjunction with C code on Unix systems, its purpose being to highlight things in the source code which weren't errors as such, but were highly questionable - to help you mop up little accidents before they happened, or to apply a bandage to a wound in the code before it became serious.

These days, the gcc compiler supports options such as -W to turn on warnings, and -ansi -pedantic to check for ANSI portability, and lint has been superseded.

Another useful code tidy program I've used in the past (for C) has been cb - the "Code Beautifier". That seems to have faded out like lint, but the indent program which (as the name suggests) indents your C blocks is still very much with us. And there are a lot of other options to indent too.

Tools for tidying up your PHP? ... have a look at the --with-tidy option when you build PHP; it's included in the distribution from PHP 5.
(written 2010-02-22, updated 2010-03-03)

 
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
C239 - C and C based languages - Putting it all together
  [4559] When do I use the this keyword in C++? - (2015-10-29)
  [4374] Test driven development, and class design, from first principles (using C++) - (2014-12-30)
  [4326] Learning to program - comments, documentation and test code - (2014-11-22)
  [3810] Reading files, and using factories to create vectors of objects from the data in C++ - (2012-07-21)
  [3252] C++ - unknown array size, unknown object type. Help! - (2011-04-17)
  [3069] Strings, Garbage Collection and Variable Scope in C++ - (2010-11-25)
  [3067] Using C and C++ functions in the same program - how to do it - (2010-11-24)
  [2851] Further C++ material - view new or old - (2010-07-04)
  [2674] Make and makefiles - a commented example to help you learn - (2010-03-12)
  [2673] Multiple Inheritance in C++ - a complete example - (2010-03-12)
  [1181] Good Programming practise - where to initialise variables - (2007-05-09)
  [945] Code quality counts - (2006-11-26)
  [925] C++ - just beyond the basics. More you can do - (2006-11-14)
  [836] Build on what you already have with OO - (2006-08-17)

H114 - Sourcing, installing and configuring PHP
  [4437] Adding a PHP build option, rotating an image based on camera data, and a new look at thumbnails in PHP - (2015-02-22)
  [4319] PHP - some quick fixes if scripts have issues, and how to use our support - (2014-11-19)
  [3955] Building up from a small PHP setup to an enterprise one - (2012-12-16)
  [3635] Parse error: parse error, unexpected T_STRING on brand new web site - why? - (2012-03-03)
  [3132] Virtual Hosting with Apache http server - an overall scheme, and avoiding common pitfalls - (2011-01-14)
  [2589] Your PHP code does not work? Here is where to start looking. - (2010-01-18)
  [2433] Controlling, supressing, enabling PHP error messages - (2009-10-02)
  [2317] How to make a Risotto (PHP build style) - (2009-08-02)
  [1936] Quick Summary - PHP installation - (2008-12-12)
  [1768] What is built in to this httpd and PHP? - (2008-08-23)
  [1731] Apache httpd, MySQL, PHP - installation procedure - (2008-08-01)
  [1688] cannot restore segment prot after reloc message - PHP / httpd - (2008-06-26)
  [1667] Checking server performance for PHP generated pages - (2008-06-06)
  [934] Clustering, load balancing, mod_rewrite and mod_proxy - (2006-11-21)
  [481] PHP upgrade - traps to watch - (2005-10-31)
  [316] Development Environments - (2005-05-19)
  [192] Current MySQL and PHP paths and upgrades - (2005-01-28)


Back to
Optimising and caching your MySQL enquiries
Previous and next
or
Horse's mouth home
Forward to
Removing duplicates from a MySQL table
Some other Articles
Getting a phone line changed ...
Length, size or capacity in Java?
Java arrays - are they true arrays or not?
Removing duplicates from a MySQL table
Compile but do not run PHP - syntax check only
Optimising and caching your MySQL enquiries
Counting rows in joined MySQL tables
Relating tables with joins in MySQL
What does a web application look like under Tomcat?
Object Oriented Programming in PHP
4759 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 at 50 posts per page


This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2019: 404 The Spa • Melksham, Wiltshire • United Kingdom • SN12 6QL
PH: 01225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/mouth/2646_Com ... -only.html • PAGE BUILT: Sat May 27 16:49:10 2017 • BUILD SYSTEM: WomanWithCat