Reputation: 15925
I was using xampp to develop locally and then I installed the PHP from the direct installer. Now in some of my PHP code, only PHP code that starts with "<?php
" is correctly parsed. Anything that starts with "<?
" or "<?=
" is completely ignored and just left as is.
How can I adjust the configuration to parse either tokens?
Upvotes: 6
Views: 3436
Reputation: 395
By using only <? as start preprocessor startup, you can get the preprocessor confused with well formed XML documents. XML stands <? for processing-instruction, imagine an XHTML document with embeded XML that requires XSLT processing... The preprocessor will get confused with the stylesheet processing instruction and will throw an error.
It's higly recomended to use the <?php processor starting tag, try using the
short_open_tag = Off in your php.ini. Also, you can try using <?php ini_set('short_open_tag', 'On'); >
if you are getting problems.
Upvotes: 3
Reputation: 655269
I recommend you to disable short_open_tag
and only work with <?php
. When short_open_tag
is enabled, it can collide with the XML processing instruction <?xml
as both the PHP open tag and XML PI start with a <?
.
Upvotes: 20
Reputation: 287450
It's a configuration option, more information on: http://www.php.net/ini.core (look for short_open_tag).
Upvotes: 1