php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #19151 Checking for a valid PHP file from PHP
Submitted: 2002-08-28 10:55 UTC Modified: 2004-06-14 09:36 UTC
From: markhers at green-ant dot com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.2.2 OS: Any
Private report: No CVE-ID: None
 [2002-08-28 10:55 UTC] markhers at green-ant dot com
In the CLI version, you can do:

     'php -l {filename}'

and find out whether the file you specified is syntactically correct.

This would be a powerful feature to be able to call from userland when deciding whether or not to include files based on whether or not they are valid PHP files.

I know this is in the Zend area of things, but it would be a very cool addition.

In /sapi/cli/php_cli.c, it seems like a trivial function. Before creating a function to submit, or someone beating me to it, is there a good reason NOT to do this?

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-29 08:45 UTC] maxim@php.net
I see no reasons why not to have it, especially if something like it was already implemented... Anyone?
 [2004-06-14 09:36 UTC] magnus@php.net
Fixed in PHP5.
bool php_check_syntax ( string file_name [, string error_message])
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 28 19:00:02 2025 UTC