PHP abbreviation not working on new server?

Possible duplicate:
<?? > tags not working in php 5.3.1

I usually use shorthand syntax

<?="hello";?> 

instead

  <?php echo "hello";?> 

I created a development server and installed the same version of php, but the shortcut method does not work, why? how can i fix this?

I would ask about it on the server site, but this is related to setting up php or what I think.

I am running linux fedora 14

+6
source share
3 answers

You need to include the short_open_tag parameter in the php.ini configuration php.ini (possibly in /etc/ ). As you have discovered, short tags are disabled by default.

Edit: and yes, as @Sebastian P points out, this has been requested before.

+15
source

Locate the php.ini file in the apache directory and change short_open_tag = On

+2
source

You probably need to include short tags, which are the ini settings as you expected.

It should be noted that short tags are seen as a bad idea (including me). I know that they are convenient and thus seductive, but this question illustrates the reason why you DO NOT use them - what if you move your code and CANNOT turn them on (for any reason)? Most portable code does not use short tags. If you need to enable them in order to do the old code, do what you need to do. If you are creating a server to launch a new project, leave it turned off!

Docs: http://www.php.net/manual/en/ini.core.php#ini.short-open-tag

+2
source

Source: https://habr.com/ru/post/885537/


All Articles