title: PHP 5.6.2 + Postgres + Apache 2.4 does not work on Yosemite
body: <p>I decided to upgrade my mac to Yosemite, but now Postgres is not working.</p>
  
  <p>This is my environment</p>
  
  <p>apachectl -v </p>
  
  <pre><code>Server version: Apache/2.4.9 (Unix)
  Server built:   Sep  9 2014 14:48:20
  </code></pre>
  
  <p>php -v </p>
  
  <pre><code>PHP 5.6.2 (cli) (built: Oct 24 2014 15:50:08) 
  Copyright (c) 1997-2014 The PHP Group
  Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies
  </code></pre>
  
  <p>PostgreSQL 9.3</p>
  
  <p>What I tried to do:</p>
  
  <p><strong>1. Install with brew</strong></p>
  
  <pre><code>brew tap josegonzalez/php
  brew install php56 --with-apache --with-mysql  --with-intl --with-pgsql=/Library/PostgreSQL/9.3/
  brew link --overwrite php56
  </code></pre>
  
  <p>enable the extension</p>
  
  <pre><code>sudo nano /usr/local/etc/php/5.6/php.ini
  </code></pre>
  
  <p>and add</p>
  
  <pre><code>extension=pdo_pgsql.so
  
  sudo apachectl restart
  </code></pre>
  
  <p><strong>2. Manual compilation</strong> </p>
  
  <pre><code>sudo pecl download pdo_pgsql
  sudo tar xzf PDO_PGSQL-1.0.2.tgz
  sudo cd PDO_PGSQL-1.0.2
  sudo phpize
  
  sudo ./configure --with-pgsql=/Library/PostgreSQL/9.3/
  sudo make
  sudo make -j5 test
  sudo make -j5 install
  </code></pre>
  
  <p><strong>3. phpbrew Installation</strong></p>
  
  <pre><code>sudo phpbrew install --mirror http://br1.php.net  5.6.2 +pdo+pgsql=/Library/PostgreSQL/9.3/bin/
  </code></pre>
  
  <p>It definitely doesn't work when I try with this file:</p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
    ini_set ("display_errors", "1");
    error_reporting(E_ALL);  
    $host        = "host=127.0.0.1";
    $port        = "port=5432";
    $dbname      = "dbname=peajetron";
    $credentials = "user=peajetron password=peajetron";
  
    $db = pg_connect( "$host $port $dbname $credentials"  ) or die('Could not connect');;
    if(!$db){
        echo "Error : Unable to open database\n";
    } else {
        echo "Opened database successfully\n";
    }
  ?&gt;
  </code></pre>
  
  <p>When I try this code I get the same error:</p>
  
  <blockquote>
    <p><code>Fatal error: Call to undefined function pg_connect() in /Library/WebServer/Documents/testConnection.php on line 10</code></p>
  </blockquote>
  
  <p>I don't know what I'm doing wrong. Can anyone help me?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>Acording with the <code>phpinfo</code> I've the php.ini in <code>/etc/php.ini</code></p>
  
  <p>Acording with php help I run this command  </p>
  
  <pre><code>php -c /etc/php.ini
  </code></pre>
  
  <p>And I've the following error:</p>
  
  <pre><code>PHP Warning:  PHP Startup: Unable to load dynamic library 
  '/usr/local/Cellar/php56/5.6.2/lib/php/extensions/no-debug-non-zts-20131226/php_pdo_pgsql.so' 
  - dlopen(/usr/local/Cellar/php56/5.6.2/lib/php/extensions/no-debug-non-zts-20131226 
   /php_pdo_pgsql.so, 9): image not found in Unknown on line 0
   PHP Warning:  PHP Startup: Unable to load dynamic library 
  '/usr/local/Cellar/php56/5.6.2/lib/php/extensions/no-debug-non-zts-20131226/php_pgsql.so' 
  - dlopen(/usr/local/Cellar/php56/5.6.2/lib/php/extensions/no-debug-non-zts-20131226/php_pgsql.so,
   9): image not found in Unknown on line 0
  </code></pre>
  
  <p><strong>Solution</strong> </p>
  
  <p>I uninstalled All and reinstalled all , according with this <a href="http://www.iyware.com/osx-yosemite-mamp-homebrew-development-setup/3/" rel="nofollow">post</a> </p>