PHP problem: how to disable short_open_tag


Hello Dreamhost. I have PHP problem:

By the W3C declaration I have to use this code:

<?xml version="1.0" encoding="UTF-8"?>

and, as you said in

<?php header("Content-Type: application/xhtml xml; charset=utf-8"); ?>

in the beginning of PHP file, but “<?xml” gives me error:
Parse error: syntax error, unexpected T_STRING in /home/.justy/username/domain/index.php on line 3

Both .htaccess’s «php_value short_open_tag false» and .php’s «ini_set(“short_open_tag”, false);» don’t work.

What should I do? How should I disable PHP’s «short_open_tag» directive?


You should disable “short_open_tag” in php.ini. You can do this by either compiling/installing you won version of PHP, or by using a copy of DreamHost’s default PHP installation with a customized php.ini.



I think short open tags should be globally switched off, personally. Nasty tagses.

Max discount on any plan with promocode SCJESSEYTOTAL


you can actually use php to write out that line, and then it won’t complain regardless of short_open_tag:

<?php='<?xml version="1.0" encoding="UTF-8"?>'; ?>

track7 - my dream-hosted site


Using customized php.ini