Skip to content

Instantly share code, notes, and snippets.

@leohdr
Forked from doole/install_psql_php.sh
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leohdr/b7b9290ef057ff3e26c0 to your computer and use it in GitHub Desktop.
Save leohdr/b7b9290ef057ff3e26c0 to your computer and use it in GitHub Desktop.
PHP_VER="5.4.17"
# Check if extension exists first
php -m | grep pgsql
# Update brew and install requirements
brew update
brew install autoconf
# Download PHP source and extract
mkdir -p ~/src; cd ~/src
wget -c http://www.php.net/get/php-$PHP_VER.tar.bz2/from/a/mirror
tar -xjf php-$PHP_VER.tar.bz2
# Go to extension dir and phpize
cd php-$PHP_VER/ext/pdo_pgsql/
phpize
# Configure for Postgress.app
# Use just "./configure" for brew version
./configure --with-pdo-pgsql="/Applications/Postgres.app/Contents/MacOS"
make
sudo make install
# Add extension to php.ini
echo "extension=pdo_pgsql.so" >> /private/etc/php.ini
# Go to extension dir and phpize
cd php-$PHP_VER/ext/pgsql/
phpize
# Configure for Postgress.app
# Use just "./configure" for brew version
./configure --with-pgsql="/Applications/Postgres.app/Contents/MacOS"
make
sudo make install
# Add extension to php.ini
echo "extension=pgsql.so" >> /private/etc/php.ini
# Check if extension exists, again
php -m | grep pgsql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment