PHP 5.3 incompatible - <? and <?php . How to fix? [duplicate]
Possible Duplicate:
<? ?> tags not working in php 5.3.1
I am running Debian Lenny and the "official" PHP version is 5.2.? -- However, I've ran across many things that now require PHP 5.3. After some googling, I have found a site to help me force debian lenny to go to 5.3.
Now I know a lot of things will break with 5.3. I don't seem to have that problem with most of the things I use. However one major problem I have always had was that I used the shorthand method of starting php code with:
<?
instead of the <?php
. This was never an issue in PHP 5.2.? because it accept开发者_C百科ed both.
However, in PHP 5.3.5.0 from dotdeb it seems like the php is required. I went through and replaced all <?
with <?php
and then replaced all <?phpphp
with <?php
. That seems to have taken care of any issues I had with my code, however the shortcut in third party code such as <?=
does not work as <?php=
. I also do not wish to run this replacement on every php file I use from here on out.
How can I get php 5.3.? to allow both the shortcut <?
and <?=
to be accepted and not require the php?
You need to enable short_open_tag
in php.ini
.
See also: <? ?> tags not working in php 5.3.1
If you don't have access to php.ini you could try using an .htaccess file:
http://php.net/manual/en/configuration.changes.php
.htaccess:
php_value short_open_tag "1"
search for <?=
replace with <?php echo
Its in the php.ini settings. If you have a webmin panel it's easy setting it up by going to others PHP config -> manage and then other settings. Else you have to do manual editing and search for manual_open_tag
精彩评论