Opened 9 years ago
Closed 8 years ago
#1717 closed defect (fixed)
GeoMoose fails to start in Xenial due to PHP7 (due to no MapScript)
Reported by: | kalxas | Owned by: | |
---|---|---|---|
Priority: | blocker | Milestone: | OSGeoLive10.0 |
Component: | OSGeoLive | Keywords: | |
Cc: | live-demo@… |
Description
The main interface shows up but the map is empty
Change History (13)
comment:2 by , 9 years ago
Summary: | GeoMoose fails to start in Xenial due to PHP7 → GeoMoose fails to start in Xenial due to PHP7 (due to no MapScript) |
---|
comment:3 by , 9 years ago
Replying to jimk:
- MapScript is updated to work with PHP 7 in a way that doesn't significantly change the API.
That should be doable, although in the related discussion on the mapserver-dev list Thomas Bonfort expressed preference to switch to SWIG for PHP MapScript when it gets support for PHP 7 (SWIG #571 Support for PHP 7).
PHP MapScript doesn't have an active maintainer currently, so people relying on it are strongly encouraged to help port PHP MapScript to PHP 7.
With the following patch can get you started, but it doesn't handle the zend_object_value
changes and zend_register_internal_class_ex
yet:
--- a/mapscript/php/php_mapscript_util.h +++ b/mapscript/php/php_mapscript_util.h @@ -59,7 +59,9 @@ #define Z_SET_REFCOUNT_P(pz, rc) zval_set_refcount_p(pz, rc) #define Z_ADDREF_P(pz) zval_addref_p(pz) #define Z_DELREF_P(pz) zval_delref_p(pz) +#if PHP_MAJOR_VERSION < 7 #define Z_ISREF_P(pz) zval_isref_p(pz) +#endif #define Z_SET_ISREF_P(pz) zval_set_isref_p(pz) #define Z_UNSET_ISREF_P(pz) zval_unset_isref_p(pz) #define Z_SET_ISREF_TO_P(pz, isref) zval_set_isref_to_p(pz, isref) @@ -68,7 +70,9 @@ #define Z_SET_REFCOUNT(z, rc) Z_SET_REFCOUNT_P(&(z), rc) #define Z_ADDREF(z) Z_ADDREF_P(&(z)) #define Z_DELREF(z) Z_DELREF_P(&(z)) +#if PHP_MAJOR_VERSION < 7 #define Z_ISREF(z) Z_ISREF_P(&(z)) +#endif #define Z_SET_ISREF(z) Z_SET_ISREF_P(&(z)) #define Z_UNSET_ISREF(z) Z_UNSET_ISREF_P(&(z)) #define Z_SET_ISREF_TO(z, isref) Z_SET_ISREF_TO_P(&(z), isref) @@ -81,6 +85,7 @@ #define zend_always_inline inline #endif +#if PHP_MAJOR_VERSION < 7 static zend_always_inline zend_uint zval_refcount_p(zval* pz) { return pz->refcount; @@ -120,6 +125,7 @@ static zend_always_inline zend_bool zval { return pz->is_ref = isref; } +#endif #endif
comment:4 by , 9 years ago
I am not a PHP developer. I have some experience with the Swig bindings for Python and Ruby so I gave the (non Swig) PHP bindings a shot for a couple hours but being unfamiliar with the PHP C API and the differences between PHP5 and PHP7, I can't make any sense of the current PHP MapScript code and what it would take to fix.
I was however able to get Python MapScript to build against Python 3.4 with some minimal changes. I'm not sure how much of it actually works, but some simple tests of loading and rendering a mapfile to an image were successful.
The GeoMoose PSC will need to discuss and decide how to proceed given the current situation. Currently, it is clear that PHP 5 and PHP MapScript are hard dependencies of the GeoMoose demo.
comment:5 by , 9 years ago
I have started looking to backport PHP5 to Xenial since all our PHP based projects have similar problem.
comment:6 by , 9 years ago
I presume you are aware of this: https://launchpad.net/~ondrej/+archive/ubuntu/php
comment:7 by , 9 years ago
Yes, thanks, that was my starting point.
Mapscript is now rebuilt against PHP5.6 here:
https://launchpad.net/~gcpp-kalxas/+archive/ubuntu/osgeolive/+packages
comment:8 by , 9 years ago
We now have a build with PHP 5.6 included (and MapServer built against it)
http://aiolos.survey.ntua.gr/gisvm/dev/osgeo-live-nightly-build101-amd64-036a7ea.iso
Build log seems normal:
=============================================================== Starting "install_geomoose.sh" ... =============================================================== Reading package lists... Building dependency tree... Reading state information... php5.6-sqlite3 is already the newest version (5.6.22-4+deb.sury.org~xenial+1). 0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded. --2016-06-05 20:34:02-- http://www.geomoose.org/downloads/geomoose-2.9.0.tar.gz Resolving www.geomoose.org (www.geomoose.org)... 207.67.9.114 Connecting to www.geomoose.org (www.geomoose.org)|207.67.9.114|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 38841159 (37M) [application/x-gzip] Saving to: 'geomoose-2.9.0.tar.gz' 0K ........ ........ ........ ........ ........ ........ 8% 2.33M 15s 3072K ........ ........ ........ ........ ........ ........ 16% 6.18M 9s 6144K ........ ........ ........ ........ ........ ........ 24% 6.18M 7s 9216K ........ ........ ........ ........ ........ ........ 32% 4.70M 6s 12288K ........ ........ ........ ........ ........ ........ 40% 6.18M 5s 15360K ........ ........ ........ ........ ........ ........ 48% 6.18M 4s 18432K ........ ........ ........ ........ ........ ........ 56% 6.18M 3s 21504K ........ ........ ........ ........ ........ ........ 64% 6.17M 3s 24576K ........ ........ ........ ........ ........ ........ 72% 6.19M 2s 27648K ........ ........ ........ ........ ........ ........ 80% 4.71M 1s 30720K ........ ........ ........ ........ ........ ........ 89% 6.18M 1s 33792K ........ ........ ........ ........ ........ ........ 97% 6.19M 0s 36864K ........ ........ 100% 6.43M=7.1s 2016-06-05 20:34:10 (5.22 MB/s) - 'geomoose-2.9.0.tar.gz' saved [38841159/38841159] =============================================================== Finished "install_geomoose.sh" Disk Usage1: install_geomoose.sh,Filesystem,1K-blocks,Used,Available,Use%,Mounted_on,date Disk Usage2: install_geomoose.sh,-,36157,15645,18653,46%,/,2016-06-05 20:34:11+00:00 Temp Usage: install_geomoose.sh,1613 /tmp ===============================================================
but when launching GeoMoose, the following error occurs (from /var/log/apache2/error.log):
[Sun Jun 05 21:00:36.007120 2016] [:error] [pid 2660] [client 127.0.0.1:50154] PHP Fatal error: Call to undefined function mb_internal_encoding() in /usr/local/geomoose/htdocs/php/config.php on line 80, referer: http://localhost/geomoose/geomoose.html
comment:9 by , 9 years ago
I'll look at it. A quick Google search indicates it might be missing the PHP mbstring module.
comment:10 by , 9 years ago
Good catch, it seems to work now:
https://github.com/kalxas/OSGeoLive/commit/85dc71a920a09d05fbf34af2a8674999bed79080
comment:11 by , 9 years ago
I just tested GeoMoose on http://aiolos.survey.ntua.gr/gisvm/dev/osgeo-live-nightly-php5-amd64-bfaddd0.iso + apt-get install php5.6-mbstring
and it looks like it is working to me.
Thanks for your efforts to get PHP 5.6/MapScript working!
comment:13 by , 8 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
This discussion has aready started in our pull request to update to GeoMoose 2.9 https://github.com/OSGeo/OSGeoLive/pull/110
In discussing with other members of the GeoMoose project, we could reasonably update our PHP code to work with PHP 7, but the lack of PHP MapScript is a complete show stopper.
We are looking at moving from PHP and MapScript in the future in favor of using a more OGC service centric approach, but that development effort is a year out at best. And redeveloping our entire demo service stack in a different language or not using MapScript would be a significant effort and cause unacceptable API breakage in the short term.
So barring other breakthroughs, the answer from the GeoMoose project is for the reasonable future we depend on MapScript. I see two potential paths forward: