By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,722 Members | 1,874 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,722 IT Pros & Developers. It's quick & easy.

'<?' versus '<?php'

P: n/a
Hi folks,

I recently ran into a PHP5 install that rejects the idiom, <? // code ?
and in fact renders that in the output that is sent to the browser.
Yikes!

The sysadmins could not say why this was but suggested it was a PHP5
thing.

So my question to you: is <?php going to become required? And if it
is will we not be allowed to echo by the shorthand <?php=$foo? as we
used to <?=$bar?? As that was broken too.

Thanks for any advice,

JG
Oct 23 '08 #1
Share this Question
Share on Google+
14 Replies


P: n/a
jerrygarciuh wrote:
Hi folks,

I recently ran into a PHP5 install that rejects the idiom, <? // code ?
>and in fact renders that in the output that is sent to the browser.
Yikes!

The sysadmins could not say why this was but suggested it was a PHP5
thing.

So my question to you: is <?php going to become required? And if it
is will we not be allowed to echo by the shorthand <?php=$foo? as we
used to <?=$bar?? As that was broken too.

Thanks for any advice,

JG

This is PHP short_open_tag setting in your php.ini file. In PHP5 it is
set to off.

Off is recommended because the short tag can cause problems with xml,
which uses the same tags.

It also means you can't use the <?= syntax.

On Apache, you can override this in your .htaccess file, if the host
allows it.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Oct 23 '08 #2

P: n/a
jerrygarciuh wrote:
Hi folks,

I recently ran into a PHP5 install that rejects the idiom, <? // code ?
>and in fact renders that in the output that is sent to the browser.
Yikes!

The sysadmins could not say why this was but suggested it was a PHP5
thing.

So my question to you: is <?php going to become required? And if it
is will we not be allowed to echo by the shorthand <?php=$foo? as we
used to <?=$bar?? As that was broken too.

Thanks for any advice,

JG
The short_open_tag option is a PHP configuration option in php.ini.
It's not reliable or portable to rely upon the availability of short
tags. The <?=$foo?syntax relies upon short tags.

It's not a problem with PHP5, it just depends on how PHP is configured.
--
Curtis
Oct 23 '08 #3

P: n/a
jerrygarciuh wrote:
Hi folks,

I recently ran into a PHP5 install that rejects the idiom, <? // code ?
>and in fact renders that in the output that is sent to the browser.
Just use sed or awk to change all instances of "<?" to "<?php". You
don't want short tags.
Oct 23 '08 #4

P: n/a
Jerry Stuckle wrote:
jerrygarciuh wrote:
>Hi folks,

I recently ran into a PHP5 install that rejects the idiom, <? // code ?
>>and in fact renders that in the output that is sent to the browser.
Yikes!

The sysadmins could not say why this was but suggested it was a PHP5
thing.

So my question to you: is <?php going to become required? And if it
is will we not be allowed to echo by the shorthand <?php=$foo? as we
used to <?=$bar?? As that was broken too.

Thanks for any advice,

JG


This is PHP short_open_tag setting in your php.ini file. In PHP5 it is
set to off.

Off is recommended because the short tag can cause problems with xml,
which uses the same tags.

It also means you can't use the <?= syntax.

On Apache, you can override this in your .htaccess file, if the host
allows it.
I think what is really disturbing is he stated that his sysadmins did
not know what the problem was.

Scotty
Oct 23 '08 #5

P: n/a
Hugh Oxford wrote:
jerrygarciuh wrote:
>Hi folks,

I recently ran into a PHP5 install that rejects the idiom, <? // code ?
>>and in fact renders that in the output that is sent to the browser.

Just use sed or awk to change all instances of "<?" to "<?php". You
don't want short tags.
Don't forget about the <?=$foo?syntax, it's not as simple as just
changing "<?" to "<?php". Something equivalent would be:

<?php echo $foo; ?>
--
Curtis
Oct 24 '08 #6

P: n/a
On Oct 23, 3:52 pm, Curtis <dye...@gmail.comwrote:
jerrygarciuh wrote:
Hi folks,
I recently ran into a PHP5 install that rejects the idiom, <? // code ?
and in fact renders that in the output that is sent to the browser.
Yikes!
The sysadmins could not say why this was but suggested it was a PHP5
thing.
So my question to you: is <?php going to become required? And if it
is will we not be allowed to echo by the shorthand <?php=$foo? as we
used to <?=$bar?? As that was broken too.
Thanks for any advice,
JG

The short_open_tag option is a PHP configuration option in php.ini.
It's not reliable or portable to rely upon the availability of short
tags. The <?=$foo?syntax relies upon short tags.

It's not a problem with PHP5, it just depends on how PHP is configured.
--
Curtis
Thanks Curtis, I'll definitely bear this in mind going forward.

JG

Oct 24 '08 #7

P: n/a
On Oct 23, 4:31 pm, Hugh Oxford <ares...@fas.comwrote:
jerrygarciuh wrote:
Hi folks,
I recently ran into a PHP5 install that rejects the idiom, <? // code ?
and in fact renders that in the output that is sent to the browser.

Just use sed or awk to change all instances of "<?" to "<?php". You
don't want short tags.
Thanks for the reply. I used UltraEdit locally and re-upped.

JG

Oct 24 '08 #8

P: n/a
On Oct 23, 3:42 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
jerrygarciuh wrote:
Hi folks,
I recently ran into a PHP5 install that rejects the idiom, <? // code ?
and in fact renders that in the output that is sent to the browser.
Yikes!
The sysadmins could not say why this was but suggested it was a PHP5
thing.
So my question to you: is <?php going to become required? And if it
is will we not be allowed to echo by the shorthand <?php=$foo? as we
used to <?=$bar?? As that was broken too.
Thanks for any advice,
JG

This is PHP short_open_tag setting in your php.ini file. In PHP5 it is
set to off.

Off is recommended because the short tag can cause problems with xml,
which uses the same tags.

It also means you can't use the <?= syntax.

On Apache, you can override this in your .htaccess file, if the host
allows it.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
Thanks Jerry! You are always the man with the answers in clphp! If
you find yourself in New Orleans I owe you some beers!

JG
Oct 24 '08 #9

P: n/a
On Oct 23, 7:17 pm, Curtis <dye...@gmail.comwrote:
Hugh Oxford wrote:
jerrygarciuh wrote:
Hi folks,
I recently ran into a PHP5 install that rejects the idiom, <? // code ?
and in fact renders that in the output that is sent to the browser.
Just use sed or awk to change all instances of "<?" to "<?php". You
don't want short tags.

Don't forget about the <?=$foo?syntax, it's not as simple as just
changing "<?" to "<?php". Something equivalent would be:

<?php echo $foo; ?>
--
Curtis
Thanks
Oct 24 '08 #10

P: n/a
jerrygarciuh wrote:
On Oct 23, 3:42 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>jerrygarciuh wrote:
>>Hi folks,
I recently ran into a PHP5 install that rejects the idiom, <? // code ?
and in fact renders that in the output that is sent to the browser.
Yikes!
The sysadmins could not say why this was but suggested it was a PHP5
thing.
So my question to you: is <?php going to become required? And if it
is will we not be allowed to echo by the shorthand <?php=$foo? as we
used to <?=$bar?? As that was broken too.
Thanks for any advice,
JG
This is PHP short_open_tag setting in your php.ini file. In PHP5 it is
set to off.

Off is recommended because the short tag can cause problems with xml,
which uses the same tags.

It also means you can't use the <?= syntax.

On Apache, you can override this in your .htaccess file, if the host
allows it.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================

Thanks Jerry! You are always the man with the answers in clphp! If
you find yourself in New Orleans I owe you some beers!

JG
Ah, yes, New Orleans. One of my favorite cities. Is Pat O'Brians back
in business after Katrina? :-)

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Oct 24 '08 #11

P: n/a
On Oct 23, 6:49 pm, FutureShock <futuresho...@att.netwrote:
Jerry Stuckle wrote:
jerrygarciuh wrote:
Hi folks,
I recently ran into a PHP5 install that rejects the idiom, <? // code ?
and in fact renders that in the output that is sent to the browser.
Yikes!
The sysadmins could not say why this was but suggested it was a PHP5
thing.
So my question to you: is <?php going to become required? And if it
is will we not be allowed to echo by the shorthand <?php=$foo? as we
used to <?=$bar?? As that was broken too.
Thanks for any advice,
JG
This is PHP short_open_tag setting in your php.ini file. In PHP5 it is
set to off.
Off is recommended because the short tag can cause problems with xml,
which uses the same tags.
It also means you can't use the <?= syntax.
On Apache, you can override this in your .htaccess file, if the host
allows it.

I think what is really disturbing is he stated that his sysadmins did
not know what the problem was.

I guess one could argue that this is a programming question, not a
sysadmin question. Though that is not a sysadmin I'd want on any of my
projects.

Oct 24 '08 #12

P: n/a
On Oct 23, 8:48 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
jerrygarciuh wrote:
On Oct 23, 3:42 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
jerrygarciuh wrote:
Hi folks,
I recently ran into a PHP5 install that rejects the idiom, <? // code ?
and in fact renders that in the output that is sent to the browser.
Yikes!
The sysadmins could not say why this was but suggested it was a PHP5
thing.
So my question to you: is <?php going to become required? And if it
is will we not be allowed to echo by the shorthand <?php=$foo? as we
used to <?=$bar?? As that was broken too.
Thanks for any advice,
JG
This is PHP short_open_tag setting in your php.ini file. In PHP5 it is
set to off.
Off is recommended because the short tag can cause problems with xml,
which uses the same tags.
It also means you can't use the <?= syntax.
On Apache, you can override this in your .htaccess file, if the host
allows it.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
Thanks Jerry! You are always the man with the answers in clphp! If
you find yourself in New Orleans I owe you some beers!
JG

Ah, yes, New Orleans. One of my favorite cities. Is Pat O'Brians back
in business after Katrina? :-)

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
I don't think Pat O's was ever out of business! ;-)
Oct 24 '08 #13

P: n/a
lawrence k wrote:
On Oct 23, 6:49 pm, FutureShock <futuresho...@att.netwrote:
>Jerry Stuckle wrote:
>>jerrygarciuh wrote:
Hi folks,
I recently ran into a PHP5 install that rejects the idiom, <? // code ?
and in fact renders that in the output that is sent to the browser.
Yikes!
The sysadmins could not say why this was but suggested it was a PHP5
thing.
So my question to you: is <?php going to become required? And if it
is will we not be allowed to echo by the shorthand <?php=$foo? as we
used to <?=$bar?? As that was broken too.
Thanks for any advice,
JG
This is PHP short_open_tag setting in your php.ini file. In PHP5 it is
set to off.
Off is recommended because the short tag can cause problems with xml,
which uses the same tags.
It also means you can't use the <?= syntax.
On Apache, you can override this in your .htaccess file, if the host
allows it.
I think what is really disturbing is he stated that his sysadmins did
not know what the problem was.


I guess one could argue that this is a programming question, not a
sysadmin question. Though that is not a sysadmin I'd want on any of my
projects.
Thats what I was thinking. But I suppose it happens.
Oct 25 '08 #14

P: n/a
lawrence k wrote:
On Oct 23, 6:49 pm, FutureShock <futuresho...@att.netwrote:
>Jerry Stuckle wrote:
>>jerrygarciuh wrote:
Hi folks,
I recently ran into a PHP5 install that rejects the idiom, <? // code ?
and in fact renders that in the output that is sent to the browser.
Yikes!
The sysadmins could not say why this was but suggested it was a PHP5
thing.
So my question to you: is <?php going to become required? And if it
is will we not be allowed to echo by the shorthand <?php=$foo? as we
used to <?=$bar?? As that was broken too.
Thanks for any advice,
JG
This is PHP short_open_tag setting in your php.ini file. In PHP5 it is
set to off.
Off is recommended because the short tag can cause problems with xml,
which uses the same tags.
It also means you can't use the <?= syntax.
On Apache, you can override this in your .htaccess file, if the host
allows it.
I think what is really disturbing is he stated that his sysadmins did
not know what the problem was.


I guess one could argue that this is a programming question, not a
sysadmin question. Though that is not a sysadmin I'd want on any of my
projects.
Although I have no sys admin experience, I would think any decent sys
admin should understand how to appropriately configure software on the
server(s) for which they are responsible. The apparent lack of
adeptness of the OP's sys admins does not bode well for future problems.

Also, it seems as if at least some minimal programming experience
overlaps, in that they should probably know how to write shell/batch
scripts. Perl is also popular among sys admins, from what I've read...
--
Curtis
Oct 25 '08 #15

This discussion thread is closed

Replies have been disabled for this discussion.