Skip to content

Instantly share code, notes, and snippets.

@giorgiofellipe
Forked from doole/install_psql_php.sh
Last active October 10, 2021 05:58
Show Gist options
  • Star 26 You must be signed in to star a gist
  • Fork 16 You must be signed in to fork a gist
  • Save giorgiofellipe/6282df335fd310de4108 to your computer and use it in GitHub Desktop.
Save giorgiofellipe/6282df335fd310de4108 to your computer and use it in GitHub Desktop.
Install PHP PGSQL extensions on Mac OS X Yosemite (change PHP_VER with your PHP version)
PHP_VER="5.5.14"
# 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://br1.php.net/distributions/php-$PHP_VER.tar.bz2
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="/Library/PostgreSQL/9.3/"
make
sudo make install
# Add extension to php.ini
sudo 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="/Library/PostgreSQL/9.3/"
make
sudo make install
# Add extension to php.ini
sudo echo "extension=pgsql.so" >> /private/etc/php.ini
# Check if extension exists, again
php -m | grep pgsql
@isc-rsingh
Copy link

sudo make install fails on OS X 10.11.1
Could it have something to do with https://en.wikipedia.org/wiki/System_Integrity_Protection?

@henryezeanya
Copy link

Please, what directory location do I place the script to be able to run it on OS X Elcapitan (10.11).

Thanks.

@azizultex
Copy link

I am on EI Capitan. to show an error:

$ sudo make install
Password:
Installing shared extensions: /usr/lib/php/extensions/no-debug-non-zts-20121212/
cp: /usr/lib/php/extensions/no-debug-non-zts-20121212/#INST@42992#: Operation not permitted
make: *** [install-modules] Error 1

@azizultex
Copy link

Ok. Works now! Just copied and pasted from here. https://gist.github.com/doole/8651341

@rodrigowerlin
Copy link

Thanks for this process, it helped me fully! ;)

@nbap
Copy link

nbap commented Nov 17, 2016

Thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment