FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » PHP server tag help
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
PHP server tag help [message #172235] Mon, 07 February 2011 14:08 Go to next message
Chee is currently offline  Chee
Messages: 1
Registered: February 2011
Karma: 0
Junior Member
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 [message #172236 is a reply to message #172235] Mon, 07 February 2011 14:19 Go to previous messageGo to next message
Luuk is currently offline  Luuk
Messages: 329
Registered: September 2010
Karma: 0
Senior Member
On 07-02-11 15:08, Chee wrote:
> 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!
>
>
>

look for: 'short_open_tag'
on: http://php.net/manual/en/ini.core.php

--
Luuk
Re: PHP server tag help [message #172238 is a reply to message #172235] Mon, 07 February 2011 14:36 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 2/7/2011 9:08 AM, Chee wrote:
> 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!
>
>
>

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.
jstucklex(at)attglobal(dot)net
==================
Re: PHP server tag help [message #172240 is a reply to message #172235] Mon, 07 February 2011 16:00 Go to previous messageGo to next message
alvaro.NOSPAMTHANX is currently offline  alvaro.NOSPAMTHANX
Messages: 277
Registered: September 2010
Karma: 0
Senior Member
El 07/02/2011 15:08, Chee escribió/wrote:
> 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?!

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

http://es.php.net/manual/en/language.basic-syntax.phpmode.php

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

http://es.php.net/manual/en/ini.core.php#ini.short-open-tag

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
directive:

php_flag short_open_tag on

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

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.»



--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
Re: PHP server tag help [message #172242 is a reply to message #172235] Mon, 07 February 2011 18:35 Go to previous messageGo to next message
richard is currently offline  richard   
Messages: 213
Registered: June 2013
Karma: 0
Senior Member
On Mon, 7 Feb 2011 06:08:45 -0800 (PST), Chee wrote:

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

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
php.

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.
Re: PHP server tag help [message #172243 is a reply to message #172240] Mon, 07 February 2011 19:22 Go to previous message
Michael Fesser is currently offline  Michael Fesser
Messages: 215
Registered: September 2010
Karma: 0
Senior Member
.oO(Álvaro G. Vicario)

> El 07/02/2011 15:08, Chee escribió/wrote:
>
>> I do not want to modify so many pages just to fix this.
>
> 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.

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

> And the feature is
> not actually deprecated:

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

Micha
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Stats comp.lang.php (last 7 days)
Next Topic: String Replacement
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 00:52:40 GMT 2024

Total time taken to generate the page: 0.02075 seconds