PHP problem: how to disable short_open_tag

PHP problem: how to disable short_open_tag

Posted by: Kir
Posted on: 2008-05-17 22:34:00

Hello Dreamhost. I have PHP problem:

By the W3C declaration I have to use this code:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd"
xml:lang="en" >

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?

Edited by Kir on 05/17/08 10:41 PM (server time).

Re: PHP problem: how to disable short_open_tag

Posted by: rlparker
Posted on: 2008-05-17 23:15:00

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

Re: PHP problem: how to disable short_open_tag

Posted by: scjessey
Posted on: 2008-05-18 08:27:00

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

-- si-blog --

Re: PHP problem: how to disable short_open_tag

Posted by: misterhaan
Posted on: 2008-05-19 07:18:00

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

Thanks guys, problem had successfully solved

Posted by: Kir
Posted on: 2008-05-20 00:09:00

Using customized php.ini