<? Vs <?php when running files

Problems with the Windows version of XAMPP, questions, comments, and anything related.

<? Vs <?php when running files

Postby mercurymike » 14. January 2013 00:53

Hi,
and thanks in advance for helping out and any time you can provide to me to sort this out.

When I run .php files if the code is encapsulated in <? ... ?> rather than <?php ... ?> it will fail. In the former code it will be displayed as plain text (am assuming that Apache is looking for <?php at the start of the code segment to understand that it is to be ran as PHP code). Is there a way I can reconfigure it to understand that <? ... ?> is the same as <?php ... ?>.

Took me three hours to work out I was having this issue, as all my code is written with <? ... ?> as the standard.

Thanks again

Mike
mercurymike
 
Posts: 2
Joined: 14. January 2013 00:49
XAMPP Version: 5.6.3
Operating System: windows

Re: <? Vs <?php when running files

Postby JJ_Tagy » 14. January 2013 01:00

Check your php.ini
JJ_Tagy
 
Posts: 514
Joined: 30. January 2012 13:44
XAMPP Version: 1.8.3
Operating System: Windows 7 x64

Re: <? Vs <?php when running files

Postby mercurymike » 14. January 2013 01:04

thanks JJ. My brain was turning to mush. Probably the Scottish weather and the time of night affecting my febrile brain.
mercurymike
 
Posts: 2
Joined: 14. January 2013 00:49
XAMPP Version: 5.6.3
Operating System: windows

Re: <? Vs <?php when running files

Postby hackattack142 » 14. January 2013 23:59

As a side note, it is generally recommended that you do not use the shortcut.

From the php.ini
; This directive determines whether or not PHP will recognize code between
; <? and ?> tags as PHP source which should be processed as such. It's been
; recommended for several years that you not use the short tag "short cut" and
; instead to use the full <?php and ?> tag combination. With the wide spread use
; of XML and use of these tags by other languages, the server can become easily
; confused and end up parsing the wrong code in the wrong context. But because
; this short cut has been a feature for such a long time, it's currently still
; supported for backwards compatibility, but we recommend you don't use them.
XAMPP Control Panel Developer
Latest CP: viewtopic.php?f=16&t=48932
hackattack142
 
Posts: 702
Joined: 20. May 2011 23:29
XAMPP Version: 5.6.3
Operating System: Windows 7 Ultimate SP1 64-Bit


Return to XAMPP for Windows

Who is online

Users browsing this forum: mkostadinov and 44 guests