Skip to content
This repository has been archived by the owner on Jun 25, 2024. It is now read-only.

syntax error on PHP 5.2.17, #63

Closed
stephankn opened this issue Dec 21, 2015 · 8 comments
Closed

syntax error on PHP 5.2.17, #63

stephankn opened this issue Dec 21, 2015 · 8 comments
Assignees

Comments

@stephankn
Copy link

tileserver.php is not working and ends with a syntax error.

Parse error: syntax error, unexpected '[' in /home/webuser/domains/example.com/public_html/map/tileserver/tileserver.php on line 344

Webhosting uses PHP 5.2.17
I believe the used syntax is only valid from 5.4+ and should be replaced by the array() function.

not working on 5.2:

      //detect image type from file
      $mimetypes = ['gif', 'jpeg', 'png'];

changed to:

      //detect image type from file
      $mimetypes = array('gif', 'jpeg', 'png');

makes is work.

@daliborjanak daliborjanak self-assigned this Jan 19, 2016
@daliborjanak
Copy link
Collaborator

I think we will not support PHP 5.2. Officially is not supported also 5.3 and 5.4. See: http://php.net/supported-versions.php

You can use release of old version 1.0 here: https://github.com/klokantech/tileserver-php/releases
It has support for 5.2

@klokan klokan changed the title syntax error on PHP 5.2.17, syntax error on PHP 5.2.17, Jan 25, 2016
@klokan
Copy link
Member

klokan commented Jan 25, 2016

@daliborjanak is the array() vs [] the only line with problem for compatibility with PHP 5.2+?
We could use the travis to check the syntax of PHP in future - but is it the only problem?

@daliborjanak
Copy link
Collaborator

I think yes but hybrid tile support will also not work. We couldn't test it easily. Better to leave old versions of PHP and link to 1.0 in my opinion. This bracket declaration is supported only in PHP >= 5.4 so 5.3 is also out.

@klokan
Copy link
Member

klokan commented Jan 25, 2016

OK. I Agree. We may push this to the checker #48.

Ideally - the tileserver.php itself should report what is the problem - if there is one - but only on request for HTML front page and only if it does not significantly slow down the response on default HTML page...

@stephankn
Copy link
Author

If you plan on changing the requirements to require something newer than PHP5.2, please change the requirements you documented for it. The webspace I had access to unfortunately was stuck with the quite old 5.2

Currently it reads: "PHP 5.2+ with SQLite module (php5-sqlite)"
https://github.com/klokantech/tileserver-php/blame/master/README.md#L41

@klokan
Copy link
Member

klokan commented Jan 25, 2016

@daliborjanak I am afraid the old PHP happens to be on a many of web hostings for quite some time...

Travis #15 seems to support 5.2 as the oldest PHP version. I would be keen to test syntax against HHVM as well. See: https://github.com/travis-ci-examples/php/blob/master/.travis.yml and https://github.com/klokantech/tileserver-php/tree/travis

@klokan
Copy link
Member

klokan commented Feb 1, 2016

Another person with the same problem:
https://groups.google.com/d/msg/maptiler/wJL09ntucEw/roqnfx2VEAAJ

@klokan
Copy link
Member

klokan commented Feb 1, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

3 participants