duanbi1983 2016-04-21 16:14
浏览 66
已采纳

我无法在geoserver上运行我的php脚本

I'm working on a webmapping application that manage geological documents. I'm using PostgreSQL and Geoserver I'm trying to fetch the data on PostgreSQL with PHP and display it on web page. This is my php script

 <?php
//mb_internal_encoding("UTF-8");
$conn = pg_connect("host=localhost port=5432 dbname=Gestion_Documents user=****** password=***")
   or die('Connexion impossible : ' . pg_last_error());
$query = 'SELECT * FROM gisement';
$res = pg_query($query) 
    or die('Échec de la requête : ' . pg_last_error());
$cols = pg_num_fields($res);
$rows = pg_num_rows($res);

for ($k = 0; $k < $rows; $k++){
    for ($j = 0; $j < $cols; $j++) {
        $line = pg_fetch_result($res, $k, $j);
        echo '"'.pg_field_name($res, $j).'": '.$line.", ";
    }
    echo "
";
}
//=========================================
//echo pg_fetch_result($res, 0, 0);
//=========================================
pg_free_result($res);
pg_close($conn);
?>

This script work perfectly with Wampserver, But it does not work when i try to run it on Geoserver So I'm trying to find a way to run the script on Geoserver.

  • 写回答

1条回答 默认 最新

  • doushang3352 2016-04-23 19:25
    关注

    GeoServer doesn't have a PHP interpreter so it can't run your script. You need to run it in the normal way beside your GeoServer install.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮