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

我无法在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.

    点赞 打赏 评论

相关推荐 更多相似问题