Question

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?

Was it helpful?

Solution

This is a php.ini setting named

short_open_tag = 1 # (enabled)

OTHER TIPS

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 <?.

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.

You can set short_open_tag = On in the php.ini

It's a configuration option, more information on: http://www.php.net/ini.core (look for short_open_tag).

For the newer version:

short_open_tag = On
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top