PHP Script Syntax Checking with CSS HTML Validator

CSS HTML Validator Box

CSS HTML Validator (standard, pro, or enterprise edition) can integrate with PHP's syntax checker for easy PHP script syntax checking. NOTE: Don't forget that CSS HTML Validator can also check the HTML output of your PHP scripts.

Follow the below steps to check PHP syntax with CSS HTML Validator :

  1. Download CSS HTML Validator and install it (the free trial will work too).
  2. Download the PHP Windows binary files (new window). We recommend downloading the Zip file and then extracting it to a folder like c:\PHP\ or C:\Program Files\PHP\. Either the "thread safe" or "non thread safe" download option will work. NOTE: Do not download the source code. If you have a 64-bit OS then either the x64 or x86 version will work, but only the x86 version will work with a 32-bit OS.
  3. Start CSS HTML Validator and go to the Validator Engine Options (Ctrl+F4) and then to the PHP Checker page. Make sure the option to enable PHP syntax messages is enabled, and the path to php.exe is set correctly to something like C:\PHP\php.exe (where you unzipped the PHP files). Click OK.
  4. In CSS HTML Validator, open your PHP document (or HTML, CSS, etc) and press F6 to check it. The results should appear in the Results Window at the bottom of the window. Messages from php.exe will begin with "[PHP]".
  5. You can also use the integrated web browser (in browse mode) to check the HTML output of PHP scripts.

PHP Script Syntax Checker Screen Shots

Validator Engine Options - PHP Checker Page

The PHP Checker Options Page in the Validator Engine Options of CSS HTML Validator.

PHP Script Checking example screenshot in CSS HTML Validator

The validation results, which include the PHP syntax check, are shown at the bottom of the window in the Results Window. Notice the PHP syntax error for the double right parenthesis in the echo() function. Validator messages from the PHP syntax checker begin with "[PHP]".