for some reason my php short code isn't working after I changed my ini file. I still see the code in the source code of the browser

<? include 'file/path'; ?>

but I changed a few of them to the <?PHP to see what would happen and those work just fine.

  • Is the file itself a .php file? (Without being able to see the code in the page itself, I can't even begin to fathom the core problem here) – Thomas Ward Feb 2 '18 at 18:01
  • no it is a php file – bckelley Feb 2 '18 at 18:01

Firstly, a note: PHP themselves actually suggests not using short-tags like this. PHP's own syntax manual even mentions this, because short-tags support is not a default option - it either has to be compiled into PHP or enabled in the php.ini file:

PHP also allows for short open tag <? (which is discouraged since it is only available if enabled using the short_open_tag php.ini configuration file directive, or if PHP was configured with the --enable-short-tags option).

Because short-tags are not a default-supported thing, this is why <? ... ?> is rendered as-is and not processed as PHP.

If you really want to make this work, then you have to set in your php.ini files for the PHP configurations this:


Depending on what web server or PHP proxy handling system you use, you may have differing php.ini locations. (This is, however, discussed in other questions and answers, such as here.)

However, as PHP themselves don't recommend using short tags, you should really consider not using short-tags at all in your PHP code.

Not the answer you're looking for? Browse other questions tagged or ask your own question.