Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

DNABeast's avatar

syntax error, unexpected identifier "version"

I have blade files for some XML calls. They start with this line

<?xml version="1.0"?>

I changed from valet to Herd recently and I started to get this error

syntax error, unexpected identifier "version"

Turns out the problem was that Herd has short php On by default. It was trying to render stuff after <? as PHP. The solution was to set

short_open_tag=Off

in my php.ini file. If you don't have access you can instead change your code to

<?php
echo '<?xml version="1.0" encoding="utf-8"?>';
?>
3 likes
5 replies
Snapey's avatar

Thanks. This saved my bacon.

I was using view templates to construct outbound XML files, and suddenly it was broke in dev but working fine in production.

Having recently switched to Herd, your posting foresaw my problem perfectly.

4 likes
aliawwad's avatar

Thank you. I was moving to new production environment and got that "version" error.

3 likes
SudipS's avatar

Thanks, it was really helpful.

2 likes
OstapBrehin's avatar

Reminder: you can use php --ini to get your ini file path.

Please or to participate in this conversation.