In Windows (WAMP) I have an index.php like this
<?xml version="1.0" encoding="utf-8"?>
<?php
// ...
?>
and it works as expected.
Now I've just configured a LAMP on Ubuntu and the same file (when invoked from a browser) gives me an error. Looking in error.log
I've found
PHP Parse error: syntax error, unexpected T_STRING in /var/www/test/index.php on line 1
If I remove first line everything works fine.
What's wrong? Why this works on Windows and not on Linux?
Could this be caused from a particular extension?
It sounds like you have short tags enabled, which will cause PHP to try and parse what comes after <?
.
Set the config option short_open_tag
in php.ini to 0
or Off
and restart Apache.
It's not a good idea to work with XML as a string.
You should use php XML libraries like http://de.php.net/manual/en/book.dom.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With