Check all PHP files in a directory for syntax errors
find php syntax errors | search for php parse error | lint php files before upgrade | php | syntax | troubleshootingfind /var/www/vhosts/example.com/httpdocs/wp-content/themes -name '*.php' -exec php -l {} \; 2>&1 | grep -v '^No syntax errors'Runs the syntax check php -l on every .php file found, without executing the code. Only files with parse errors are printed. Useful before switching PHP versions or after manual changes to theme and plugin files.
Note: For a PHP upgrade, check with the target version, for example /opt/plesk/php/8.3/bin/php -l. The syntax check does not find runtime errors such as deprecated functions.
Also searched as
- find php syntax errors
- search for php parse error
- lint php files before upgrade