Home > debugging, howto, php > Debugging php scripts with php-cli

Debugging php scripts with php-cli

Yet one can use ini_set("display_errors", 1); in php scripts to turn on error reporting (which might sometimes output a blank, dont-know-what-goes-wrong web page due to some simple syntax errors), there’s another quick and simple way to find all the syntax errors before even run it for the first time, and that is php command line (assuming that the php CLI is installed):
php -l script_name.php

What it does is checking for any syntax erros in the file script_name.php. I use this technique quite often to examine php scripts before I copy them to the web server.

Categories: debugging, howto, php
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: