Enable PHP support for postgresql in Ubuntu 11.04 server

前端 未结 3 1039
有刺的猬
有刺的猬 2021-01-01 13:04

I\'ve installed Apache2 with php5 support and everything works there. I\'ve installed PostgreSQL and am able to connect to it using the terminal and execute SQL statements.

3条回答
  •  渐次进展
    2021-01-01 13:38

    Currently, I am using Ubuntu 16.04 LTS. Me too was facing same problem while Fetching the Postgress Database values using Php so i resolved it by using the below commands.

    Mine PHP version is 7.0, so i tried the below command.

    apt-get install php-pgsql

    Remember to restart Apache.

    /etc/init.d/apache2 restart
    

    Below is my code , might be someone get benefited :

    - testdb.php

     
         
            "; 
                echo pg_last_error(); 
                exit(); 
            } 
    
            while($myrow = pg_fetch_assoc($result)) { 
                printf ("", $myrow['id'], htmlspecialchars($myrow['name']));
            } 
            ?> 
            
    Friend ID Name
    %s%s

提交回复
热议问题