PHP problem: how to disable short_open_tag


#1

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 http://wiki.dreamhost.com/index.php/XHTML

<?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?


#2

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.

http://wiki.dreamhost.com/Custom_PHP.ini
http://wiki.dreamhost.com/PHP.ini
http://wiki.dreamhost.com/Installing_PHP5
http://wiki.dreamhost.com/Installing_PHP4
http://wiki.dreamhost.com/Advanced_PHP_configuration

–rlparker


#3

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

si-blog
Max discount on any plan with promocode SCJESSEYTOTAL


#4

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


#5

Using customized php.ini