PHP server tag help

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi everyone.

I havent dont PHP much and my friend ask me to setup some PHP website
locally using wamp server.

I am really bad at this so hope someone can help me out.

the website i got have tags like  <? echo 'test' ?> however it seems
like my version of PHP 5.3.3 is not working well with this syntax. Is
there a way to config wamp server to accept this?!

I do not want to modify so many pages just to fix this.

Thanks guys!

Re: PHP server tag help

On 07-02-11 15:08, Chee wrote:
Quoted text here. Click to load it

look for: 'short_open_tag'


Re: PHP server tag help

On 2/7/2011 9:08 AM, Chee wrote:
Quoted text here. Click to load it

You need to set short_open_tags on.

But you really do not want to do this.  It will conflict with xml, and
the PHP developers strongly recommend against using it.  You're almost
assuredly going to have to change this sooner or later; now is the time
to do it instead of when the site breaks.

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Re: PHP server tag help

El 07/02/2011 15:08, Chee escribió/wrote:
Quoted text here. Click to load it

PHP has up to four different tags to escape escape HTML from PHP:

The one your app is using is called "short open tag" and it's a
configurable setting:

If PHP runs as Apache module, you can simply create or edit an
".htaccess" file in the document root add enable it with this Apache

php_flag short_open_tag on

Quoted text here. Click to load it

There's no need to edit the code and I wouldn't recommend it. Rewriting
some legacy third-party code to replace short open tags can be a
daunting task even for experienced PHP programmers. And the feature is
not actually deprecated:

«Using short tags should be avoided when developing applications or
libraries that are meant for redistribution, or deployment on PHP
servers which are not under your control, because short tags may not be
supported on the target server. For portable, redistributable code, be
sure not to use short tags.»

-- - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web:
-- Mi web de humor satinado:

Re: PHP server tag help

.oO(Álvaro G. Vicario)

Quoted text here. Click to load it

Depends on how and where the short open tags are used. Most of it should
be simple find & replace.

Quoted text here. Click to load it

But IMHO it should be considered as that. There were many discussions
about whether to already drop it in PHP 6 or not.


Re: PHP server tag help

On Mon, 7 Feb 2011 06:08:45 -0800 (PST), Chee wrote:

Quoted text here. Click to load it

In my layman's opinion, when I see a tag like that one, I call it a cheap
shot from someone trying to convert html to php without knowing what they
were doing.
Years ago I tried an html to php conversion program and all it did was
"echo" every line.

Learn to use PHP for what it is. Don't rely on it for every line of code.
In your given case, change to <div>test</div>. Without any reference to

I looked at some code for a bulletin board and saw where they had coded
stuff like somelongstring$[100]="to".
IMO, that's abusing the server.

Site Timeline