PHP server tag help [message #172235] |
Mon, 07 February 2011 14:08 |
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 |
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 |
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 |
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 #172243 is a reply to message #172240] |
Mon, 07 February 2011 19:22 |
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
|
|
|