That isn’t an error, it’s showing raw PHP as text, that means you don’t have things setup correctly… Apache/PHP/mod-php or whatever you’re using… it’s not interpreting php extensions as php scripts so it’s just dumping it as plain text…
Sounds like you have php cli installed so you can run php -v but your web server isn’t configured to make use of it.