RES: [PHP] Making sure an include file works
| From: | Thiago Pojda | Date: | Fri, 29 Feb 2008 19:33:48 +0000 |
| Subject: | RES: [PHP] Making sure an include file works | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-270758@lists.php.net to get a copy of this message | ||
De: Daniel Brown [mailto:parasane@gmail.com]
On Thu, Feb 28, 2008 at 9:58 PM, Richard S. Crawford
<rscrawford@mossroot.com> wrote:
> I'm trying to figure out a way to make sure an included PHP file has
> no syntax errors before actually including it as a part of project.
> Is this even possible? I'm running into brick walls.
As far as I know, the only way to do that is via the CLI
(or accessing the include file directly in the browser).
Make sure that error_reporting is enabled and that it's set
to report E_ALL if you want to really be sure your code is
clean (i.e. - reporting unused, undefined, and uninstantiated
variables, et cetera).
Then, if done from a *nix command line, just type:
php -l /path/to/include/file.php
--
</Dan>
--**--
Just being curious and lazy. The description of php -l in php.net says it
executes the script to check it's syntax.
Ok, but... It _executes_ the script as if I ran it directly? or just
_checks_ it's syntax?
There's a big difference in there.
--
PHP General Mailing List (http://www.php.net/) To unsubscribe,
visit: http://www.php.net/unsub.php