Is it possible to check syntax of php-code (without running), similar to the
php-cli -l
when running php the "ordinary" way (as a module)?
There are also some PECL extensions which parse PHP code for various reasons. First there is BCompiler, which can compile a PHP into byte code. Since this step requires parsing the PHP code, I would expect errors if it isn't lint. Parsekit allwos you to compile PHP code to OP codes, which is basically what you desire. However, the extension did not have a release since late 2009, so it might be outdated. Parse_Tree is sadly unmaintained since 2007, but its purpose is to parse a PHP file into an AST. Maybe you can get to something with this one, after some polishing.
PHP_Parser is a PEAR package, which does not rely on special PHP extensions and attempts to parse PHP code from within PHP. Its marked alpha and unmaintained, but it might give you a basis to experiment with.
You can try to run a tool like PHP Depend on the sources, which attempts to parse the given PHP files into an abstract syntax tree. While this might not catch all PHP parser errors, it will already catch quite a lot of them.
You get nice software metrics as an additional goodie, if the code is valid. :)
Is it possible to check syntax of php-code (without running), similar to the php-cli -l when running php the "ordinary" way (as a module)?
I think the question everyone missed is that there is no difference in PHP syntax whether you run it as a module, or simply execute the binary from a shell: the PHP syntax is the same on both occasions. So, you might as well just use php -l filename.php, as that has the exact same result as using the tools listed above.
For getting the same result as php-cli -l, use the function: php_check_syntax