title: PHP PDO for Postgres not enabled even though enabled in php.ini file
body: <p>I am inserting records into a Postgres database table using PDO with named placeholders, but I get an error.  I did not have PHP error logging turned on, so I enabled that, to go into php_errors.log (I created that new log file).  </p>
  
  <p>The new error log shows only two startup warnings:  </p>
  
  <pre><code>[13-Aug-2019 17:26:08 UTC] PHP Warning:  PHP Startup: Unable to load dynamic library 'pdo_pgsql' (tried: /usr/lib/php/20180731/pdo_pgsql (/usr/lib/php/20180731/pdo_pgsql: cannot open shared object file: No such file or directory), /usr/lib/php/20180731/pdo_pgsql.so (/usr/lib/php/20180731/pdo_pgsql.so: undefined symbol: pdo_parse_params)) in Unknown on line 0
  
  [13-Aug-2019 17:26:08 UTC] PHP Warning:  Module 'pgsql' already loaded in Unknown on line 0
  </code></pre>
  
  <p>The file /usr/lib/php/20180731/pdo_pgsql.so is there, despite what the warning says.  In my php.ini file, the following lines are uncommented:</p>
  
  <pre><code>extension=pdo_pgsql
  extension=pgsql
  </code></pre>
  
  <p>I thought that was all I need to do to enable pdo.  However, in my phpinfo web page there is no entry for pdo, as there should be, so it looks like pdo is not there, even though pgsql works at least to log onto a Postgres database.  </p>
  
  <p>I do know that php is working with Postgres because when I run the script without the database insertion code (just logging on to Postgres), the dev console shows a success message (“successfully connected to database”).  </p>
  
  <p>My question is:  what else do I need to do to enable pdo?  </p>
  
  <p>Here is the full script file, although it may not be needed for this question.  As I said, without the try-catch block below, the dev console reports a successful logon to the Postgres database, but when I enable to try-catch block with the pdo record insertion code, it fails, apparently because pdo is not enabled.  </p>
  
  <pre><code>&lt;?php
  echo 'Hello ' . htmlspecialchars($_POST["firstname"]) . '!' ;
  $dsn = vsprintf('pgsql:host=%s;port=%s;dbname=%s;user=%s;password=%s',  [
      'host' =&gt; 'xx.xxx.xxx.xxx',
      'port' =&gt; '5432',
      'dbname' =&gt; 'dbname',
      'user' =&gt; 'username',
      'password' =&gt; 'password',
  ]);
  
  echo $dsn;
  echo PHP_EOL;
  
  try{
   // create a PostgreSQL database connection
   $conn = new PDO($dsn);
  
   // display a message if connected to the PostgreSQL successfully
   if($conn){
   echo "Connected to the database successfully!";
   }
  }catch (PDOException $e){
   // report error message
   echo $e-&gt;getMessage();
  }
  
  $fields = array('date', 'email', 'firstname', 'lastname', 'password',   'comments', 'sendupdates');
  $fieldlist = implode(',', $fields);
  
  echo $fieldlist;
  echo PHP_EOL;
  
      $datefield = $_POST['datefield'];
      $email_field = $_POST['email_field'];
      $firstname = $_POST['firstname'];
      $lastname = $_POST['lastname'];
      $password = $_POST['password'];
      $comments = $_POST['comments'];
      $custom_checkbox = $_POST['custom_checkbox'];
  
  echo $datefield;
  echo PHP_EOL;
  echo $email_field;
  echo PHP_EOL;
  echo $firstname;
  echo PHP_EOL;
  
  echo $lastname;
  echo PHP_EOL;
  echo $password;
  echo PHP_EOL;
  echo $comments;
  echo PHP_EOL;
  echo $custom_checkbox;
  echo PHP_EOL;
  
  
  try {
  
      $datefield = $_POST['datefield'];
      $email_field = $_POST['email_field'];
      $firstname = $_POST['firstname'];
      $lastname = $_POST['lastname'];
      $password = $_POST['password'];
      $comments = $_POST['comments'];
      $custom_checkbox = $_POST['custom_checkbox'];
  
      $data = [
          'date' =&gt; $datefield,
          'email' =&gt; $email_field,
          'firstname' =&gt; $firstname,
          'lastname' =&gt; $lastname,
          'password' =&gt; $password,
          'comments' =&gt; $password,
          'checkbox' =&gt; $custom_checkbox,
      ];
  
      $sql = "INSERT INTO psq01 (date, email, firstname, lastname, password, comments, sendupdates) VALUES (:date, :email, :firstname, :lastname, :password, :comments, :checkbox)";
  
      $stmt= $pdo-&gt;prepare($sql);
      $stmt-&gt;execute($data);
  
  } catch (PDOException $e) {
      error_log($e-&gt;getMessage());
  }
  
  $conn = null;
  
  ?&gt;
  </code></pre>
  
  <p>So again, what else do I need to enable PDO?  I'm using Ubuntu 18.04.  </p>
  
  <p>Thanks for any help with this. </p>