5

I have the following code:

<?php$selectbox->display();?>

which is not too much nice, but runs well on Ubuntu PHP 7.0.3-1+deb.sury.org~vivid+1 (mod_php)

On my uberspace with PHP 7.0.3 (FCGI) I get the error

mod_fcgid: stderr: PHP Parse error:  syntax error, 
   unexpected '$selectbox' (T_VARIABLE) 

Why could this be?

Just asking out of curiosity - the fix itself is simple of course.

Community
  • 1
  • 1
Alex
  • 32,506
  • 16
  • 106
  • 171

1 Answers1

3

The issue is not due to different system. It depends on php configuration in php.ini file. In this case it depends on the short_open tag.

Maybe short_open is set to On in php.ini at uberspace, so after <? it will be considered as php starts and take the php(after <?) as constant. Therefore it will throw error for $selectbox. You can try with following debugging for confirm that its an actual problem of short_open.

1) Set short_open to Off. In php.ini change following line

short_open_tag = On

to

short_open_tag = Off

2) Or, Remove php after <? If you don't want to change php configuration

<?$selectbox->display();?>
samAlvin
  • 1,648
  • 1
  • 11
  • 35
B. Desai
  • 16,414
  • 5
  • 26
  • 47