Main Content
Syntax checking in PHP Archive - Originally posted on "The Horse's Mouth" - 2006-11-07 08:10:31 - Graham Ellis
If you want to check the syntax of your PHP page without actually running it, the -l option (that's lower case letter L) to PHP at the command line will do that for you:
wellho@lightning:~/public_html$ php -l index.php
No syntax errors detected in index.html
wellho@lightning:~/public_html$
Remember - even if you're developing code on a systems that's not your main server, you can install an Apache httpd and a PHP onto almost any systems for testing .... including the PHP command line.
Some other articles
H999 - Additional PHP Material Image indexer / thumbnail display scripts in PHP Catchable fatal error in PHP ... How to catch, and alternative solutions such as JSON Arrays of arrays - or 2D arrays. How to program tables. Exception handling in PHP If nothing, make it nothing. Extra PHP Examples PHP Techniques - a workshop Flipping images on your web page Script to present commonly used images - PHP Copyright and theft of images, bandwidth and members. More PHP sample and demonstration programs Ordnance Survey Grid Reference to Latitude / Longitude Converting from postal address to latitude / longitude Controlling and labelling Google maps via PHP PHP Standalone - keyboard to screen Drawing hands on a clock face - PHP Drawing dynamic graphs in PHP Sorting people by name in PHP Parallel processing in PHP Dates, times, clickable diarys in PHP Display an image from a MySQL database in a web page via PHP This article Reporting on the 10 largest files or 10 top scores PHP - a team member leaves Check your user is human. Have him retype a word in a graphic Hot answers in PHP Presentation, Business and Persistence layers in Perl and PHP PHP Image viewing application PHP - setting sort order with an associative array Merging pictures using PHP and GD Running a Perl script within a PHP page Double Dollars in PHP Stand alone PHP programs Time calculation in PHP the array returned by preg_match_all More maps Ordnance Survey - using a 'Get a map' What and why for the epoch PHP and natural sorting H312 - Tips and Techniques The power of scripting FileMaker Day to Unix Time conversion PHP - some quick fixes if scripts have issues, and how to use our support Problem ... I want to print a series of numbered forms A comment on comments in PHP How to set up short and meaningfull alternative URLs How did I do THAT? PHP preg functions - examples and comparision Injection Attack if register_globals in on - PHP Keeping PHP code in database and running it PHP - Parse error: syntax error, unexpected $end ... Two PHP include files to make easy web site indexing and navigation Checking server performance for PHP generated pages Easy conversion - image formats, currencies and distances PHP Standalone - keyboard to screen Dates, times, clickable diarys in PHP This article Hot answers in PHP H101 - Introduction to PHP The power of scripting We not only teach PHP and Python - we teach good PHP and Python Practice! Learning to Program ... in PHP. Course examples. PHP Course - for hobby / club / charity users. PHP - Parse error: syntax error, unexpected $end ... Perl v PHP, choosing the right language Q - Should I use Perl or Python? From Web to Web 2 The HTML++ Metalanguage Sludge off the mountain, and Python and PHP The LAMP Cookbook - Linux, Apache, MySQL, PHP / Perl This article Is Perl being replaced by PHP and Python? Remember a site's non-technical issues too Hot answers in PHP Why reinvent the wheel Testing you Perl / PHP / MySQL / Tcl knowledge PHP - London course, Melksham Course, Evening course Choosing the right language It's REALLY easy to add a little PHP Learning to program in Perl or PHP FTP - how to make the right transfers Central London Courses - Perl, PHP, Python, Tcl, MySQL Bridging to the customer requirement Happy Birthday, PHP Programming languages - a comparison Too many Perls Portrait of the author PHP v Java Case Sensitive? Evening classes to learn PHP PHP - onwards and upwards