View Full Version : <?php ?>
cancer10
Jun 9th 2007, 11:06 am
For some reasons my php code does not work unless i put the php keyword after the ? in my code as shows in the following example.
<?php
echo "Hello";
?>
The above code works
<?
echo "Hello";
?>
The above code does not work
What settings do i need to do to make the second code work?
Thanx
krakjoe
Jun 9th 2007, 11:11 am
allow_short_tags needs to be enabled in your php.ini
PHP's official opening tag is infact <?php, <? is a short version, not all servers support it.
cancer10
Jun 9th 2007, 11:21 am
How do I enable it?
PS: I have the remote desktop access to my server.
cfguy
Jun 9th 2007, 11:22 am
you need to locate and edit your php.ini file on the server.
InFloW
Jun 9th 2007, 1:04 pm
How do I enable it?
PS: I have the remote desktop access to my server.
There should be a short_open_tag in your PHP.ini and as of right now it's set to Off I imagine. So just set it to On and restart the web server and you should be able to use <? . Of course <? is a deprecated feature is it that hard to type <?php ? :P
ansi
Jun 9th 2007, 1:27 pm
i would recommend sticking with <?php personally as it'll work on any server. you don't have to worry about short tags being enabled or not. and plus that, it's only 3 extra characters. and thank god for asp style tags <% %> disappearing in php6 :)
coderbari
Jun 9th 2007, 1:34 pm
yes <?php should be used.there is not much work need to write those 3 letters(php) but it will save you u from lot of problem
vBulletin® v3.6.8, Copyright ©2000-2008, Jelsoft Enterprises Ltd.