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 comsol温度场仿真无法模拟微米级激光光斑
  • ¥15 上传图片时提交的存储类型
  • ¥15 Ubuntu开机显示器只显示kernel,是没操作系统(相关搜索:显卡驱动)
  • ¥15 VB.NET如何绘制倾斜的椭圆
  • ¥15 在rhel8中安装qemu-kvm时遇到“cannot initialize crypto:unable to initialize gcrypt“报错”
  • ¥15 arbotix没有/cmd_vel话题
  • ¥20 找能定制Python脚本的
  • ¥15 odoo17的分包重新供应路线如何设置?可从销售订单中实时直接触发采购订单或相关单据
  • ¥15 用C语言怎么判断字符串的输入是否符合设定?
  • ¥15 通信专业本科生论文选这两个哪个方向好研究呀