macOS Mojave 10.14.3
PHP 7.1.23
Prestashop 1.7.5.1
I tried to install PHP intl extension on my local server in order to use Prestashop.
I added extension=php_intl.so to etc/php.ini
When I try to install Prestashop I get Intl extension is not loaded.
$ php -m | grep intl
When I do $ php -m | grep intl, I get:
PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/local/lib/php/pecl/20160303/php_intl.so' - d
lopen(/usr/local/lib/php/pecl/20160303/php_intl.so, 9): image not found in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/pecl/20160303/php_intl.so' - dlopen
(/usr/local/lib/php/pecl/20160303/php_intl.so, 9): image not found in Unknown on line 0
intl
It seems that the file php_intl.so doesn't exist.
$ sudo pecl install intl
I also tried $ sudo pecl install intland I get:
make: *** [php_intl.lo] Error 1
ERROR:make' failed`
$ curl -s http://php-osx.liip.ch/install.sh | bash -s 7.1
I also tried $ curl -s http://php-osx.liip.ch/install.sh | bash -s 7.1 and it doesn't create the intl.so file.
How can I solve this problem?
Brew's PHP 7.1, 7.2 and 7.3 all have INTL enabled by default.
Most probably, you're just using your Mac OS' bundles version of PHP.
Run
ls -l $(which php)
to find out where the current PHP binary is located and whether it is symlinked to a Brew installation or not. In my case, for example:
lrwxr-xr-x 1 27 May 23 16:30 /usr/local/bin/php -> ../Cellar/php/7.3.5/bin/php
Meaning that my php is linked to Brew's 7.3.5 version.
If you are NOT using Brew's PHP, you'll see something like
-rwxr-xr-x 1 11169664 Mar 21 07:09 /usr/bin/php
Installing PHP through Brew
Find out whether you've already installed PHP:
brew list | grep php
If there is any output, and your version of PHP is present, go to step 2, or use step 1 to update PHP to the latest version.
1. Install Homebrew's PHP
brew install php#7.3
(or 7.2, 7.1). If Brew complains about not being able to find a formula, you might have messed with taps. Instead of php#7.3, you could try to supply the full path to the current php formula:
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/php.rb
Still not working, check whether you are running a recent version of Homebrew brew --version.
Homebrew 2.1.3-31-geaf2370
Homebrew/homebrew-core (git revision fd1ef; last commit 2019-05-25)
Homebrew/homebrew-cask (git revision 16d50; last commit 2019-05-26)
2. Link Homebrew's PHP
Now, to have php 'in your path', there are two options.
a) Either homebrew's version must be linked from its install location (/usr/local/bin/Cellar/php....) to a directory in your path (e.g., /usr/local/bin). To do this, run:
brew link --force php#7.3
If you are not able to link, this is typically caused by set permissions or System Integrity Protection. In the first case, try sudo chown "$USER":admin /usr/local/bin/php.
b) Or, add the /usr/local/opt/php#7.3 directory (opt-prefix) to your $PATH variable. E.g., for Bash:
echo 'export PATH="/usr/local/opt/php#7.3/bin:/usr/local/opt/php#7.3/sbin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
3. Validate installation
ls -l $(which php)
should show that php is linked to a Homebrew PHP installation in /usr/local/bin/Cellar.
php -v
should show the recently installed version of PHP. Try to restart your terminal if that's not the case.
php -i | grep -i intl
should show some information about the current install of intl.
If you're using webservers and/or PHP FPM, this is the time to restart those services. (Or restart your system, if you don't know how to do that and cannot figure out).
Possible issues
If you still get warnings about missing extensions (Unable to load dynamic library, etc.), then your php.ini is messed up.
Find the current location of php's ini
$ php -i | grep \.ini
Configuration File (php.ini) Path => /usr/local/etc/php/7.3
Loaded Configuration File => /usr/local/etc/php/7.3/php.ini
Scan this dir for additional .ini files => /usr/local/etc/php/7.3/conf.d
Additional .ini files parsed => /usr/local/etc/php/7.3/conf.d/ext-opcache.ini
....
Edit /usr/local/etc/php/7.3/php.ini and find the offending extension load (e.g., extension="myext.so"). Comment out those that cannot be found.
Homebrew permissions
Some argue that it's a good idea to chown /usr/local.
sudo chown -R "$USER":admin /usr/local
This will make installing things here, by hand and through Homebrew, a lot easier, but also a bit less secure too, since non-root processes are now allowed to write here too.
Your web-application is using a different version of PHP.
Make sure that it doesn't... The configuration of this depends on the used webserver. A first step would be to output the current PHP configuration in your web-application with <?php phpinfo();.
This explains steps for Apache.
Another way to get a webserver + PHP stack running quicly is using Laravel Valet.
Installing additional extensions
To install additional PHP extensions, use PEAR.
pear -V
should output the current PEAR and PHP version.
PEAR Version: 1.10.9
PHP Version: 7.3.5
Zend Engine Version: 3.3.5
Now, to install an extension, for example, PHP's yaml extension:
pear install yaml
I have seen a lot of answers about this problem and anyone helped me, but the last (of course). This is for XAMPP´s use.
Xcode is needed.
Download the version of php you use in xampp from php.net.
Extract it and open the extracted folder in a terminal using cd.
Change to subfolder ext/intl.
Run these commands to build the extension:
/Applications/XAMPP/bin/phpize
./configure --enable-intl --with-php-config=/Applications/XAMPP/bin/php-config --with-icu-dir=/Applications/XAMPP/xamppfiles/
make
sudo make install (password required)
Delete all files you downloaded and also the extracted folders.
Add to php.ini file in xampp/etc folder line
extension="intl.so"
Original link: https://community.apachefriends.org/viewtopic.php?p=255061&sid=27afc55649dfe6ea7b0824cb0bb8486b
Since php 7 it's not necessary load the extension php_intl.so, what do you need to do?, edit your php.ini and delete or comment the line that is loading the extension php_intl.so, after this reload your apache and try again.
There might be an issue with brew
You could try to use this as mentioned there:
brew tap kyslik/homebrew-php
brew install kyslik/php/php71-intl
i tried all but intl not working in mac so please uninstall xampp and install mamp it will work
So, on Pecl Official site ( https://pecl.php.net/package/intl ), it's clear that Intl package is not maintained anymore and has been superseded. Since PHP 5.3.0 you don't need to use Pecl to install intl extension, it's bundled with PHP.
But, it's missing on native instalation of PHP 7.1.24 on Mac OS Mojave.
if you wanna use only native apache and php pre-installed instead of using homebrew, do this:
Download PHP 7.1 from php.net, install XCode Command Line Tools, ICU (http://site.icu-project.org/), Autoconf, reinstall the developer tools header files, and finally install Intl extension using phpize.
Important: you'll have to disable SIP.
Related
How is it that php-ast is listed in phpinfo() but not when running $ php -m to list modules?
Working on installing phan, the static analyzer. I use MAMP Pro and have verified that $ which php returns the desired php version within MAMP. I have updated the php.ini file, and running phpinfo() displays AST as expected.
When I run vendor/bin/phan without the flag, I still get the warning that AST should be installed.
I have run it once with the flag to use the polypill parser, and phan works as expected.
Getting started with Phan (see also README for slightly different
instructions): https://github.com/phan/phan/wiki/Getting-Started
PHP-AST Project: https://github.com/nikic/php-ast#installation
Changing PHP: https://gist.github.com/irazasyed/5987693
Install autoconf to overcome related problem:
https://gist.github.com/anunay/7698181
Note: Answers elsewhere using --with-config-file-path don't seem to be working for me as I get a list of valid PHP console commands and it is not one of them: PHP module is shown in phpinfo(), but not php -m
My best guess is that you need to install the ast extension first.
What I did is this
Install PEAR following the instructions in this post
It's basically two commands
curl -O https://pear.php.net/go-pear.phar
sudo php -d detect_unicode=0 go-pear.phar
Note that I have updated the URL to use https
I've simply acknowledged the default config during installation of PEAR, hoping that it will not disturb MAMP in normal operation to have some extra directories.
Download ast from pecl.php.net, since I couldn't make pecl install ast work, maybe it works for you. Then you'll need to run sudo pear install [path-to-downloaded-ast.tgz], replacing the file path with your download location.
Edit php.ini like you already did, adding the extension.
Result should be this
$ php -m
[PHP Modules]
ast
...
How can I install intl PHP extension in PHP 7.1.7, which is delivered with osx high sierra?
So I had the exact same issue. As noted by other folks commenting here, High Sierra comes with PHP 7.1 installed and this PHP version has intl compiled with it
In my case, I followed part of Neodork comment's in the following Valet+ issue:
"Install" PHP 7.1 (so it comes from brew itself, not the one installed by High Sierra)
brew install php#7.1
Upgrade it to latest version
brew upgrade php#7.1
Symlinks for references in Cellar:
brew link --overwrite --force php#7.1
Change PHP path in my bash profile
echo 'export PATH="/usr/local/opt/php#7.1/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/php#7.1/sbin:$PATH"' >> ~/.bash_profile
Reload your bash profile (you can close the terminal and open it again)
. ~/.bash_profile
Check for Intl
php -m | grep intl
Note: If you come across with warnings like:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/opt/php71-intl/intl.so'
Then you have to disable the previous intl:
mv /usr/local/etc/php/7.1/conf.d/ext-intl.ini /usr/local/etc/php/7.1/conf.d/ext-intl.ini.disabled
Hope it helps!
After the integration from brew/php to brew/core, the intl extension is included by the default installation. I also had the same problem the intl extension wasn't working. The problem I had was the command-line environment was not using the installed version of PHP but the default version from macOS system.
To enable the installed version, you need to do this:
After
brew install php#7.1
You need to link the installed PHP version by
brew link php#7.1
Then you need to OPEN A NEW TERMINAL to make it effective.
Then double check the PHP binary path,
which php
make sure it's
/usr/local/bin/php
instead of
/usr/bin/php
Then check if the intl extension is enabled,
php -m | grep intl
It works for me.
open a terminal then type:
brew search intl
you should be able to see php71-intl, then run
brew install homebrew/php/php71-intl
then restart apache
sudo apachectl restart
then type:
php -i | grep intl
you should be able to see something like this:
Additional .ini files parsed => /usr/local/etc/php/7.1/conf.d/ext-intl.ini
intl
intl.default_locale => no value => no value
intl.error_level => 0 => 0
intl.use_exceptions => 0 => 0
Enjoy!
I'm running the brew 1.6.2, on OS High Sierra. The intl extension is not available in brew packages so far.
The #Mondy solution worked fine for me. After run the
curl -s http://php-osx.liip.ch/install.sh | bash -s 7.1
The packages will be available in /usr/local/php5 or /usr/local/php5-7.0.27-20180201-135220.
So in your /usr/local/etc/php/7.0/php.ini you can place the following lines to enable the intl extension:
[intl]
extension="/usr/local/php5/lib/php/extensions/no-debug-non-zts-20151012/intl.so"
In my case I prefered to create a file 'ext-intl.ini' in /usr/local/etc/php/7.0/conf.d/, just for a better organization.
try this on Mac
php -v
sudo port install php7*-intl
More information
You can find port packages by this page https://www.macports.org/ports.php?by=name&substr=intl
And you can install port through these steps: https://guide.macports.org/chunked/installing.macports.html
curl -O https://distfiles.macports.org/MacPorts/MacPorts-2.5.4.tar.bz2
tar xf MacPorts-2.5.4.tar.bz2
cd MacPorts-2.5.4/
./configure
make
sudo make install
And change ~/.bash_profile
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
If there is error, check following steps:
check port
sudo port list
sudo port selfupdate
sudo port search --name --glob 'php*'
sudo port install php**-intl
This page has more info about port usage: https://guide.macports.org/chunked/using.html
In addition to what L. Grolleau says (run brew install php71-intl), paste the int.so path to the /php.ini at the end of the file:
extension=/usr/local/Cellar/php71-intl/7.1.11_20/intl.so
I find a solution.
curl -s http://php-osx.liip.ch/install.sh | bash -s 7.1
Then I copied intl.so from the installation to my extension directory, which is defined into my php.ini.
I have managed to work this out.
First uninstall any php packages you have completely with brew, then run the brew update and brew doctor commands.
Now install with brew install php#7.1 (changed the version as needed) intl is included in the build for all php-formulae.
To confirm it is working run php -m | grep intl. You will see the intl extension is included. If not check the php.ini file and make sure the extension is being loaded.
Remove the following file with
rm /usr/local/etc/php/7.1/conf.d/ext-intl.ini
Worked for me, thanks to homebrew-core Issue
I installed php7.2 with brew and linked with that version on Mac, but cannot see even the version number 7.2 in phpinfo().
It always showed the last version(7.1) even though uninstall with brew, so the intl extension.
I found we have to modify httpd.conf file(in my case in /etc/apache2/httpd.conf), in that file you can find the
LoadModule php7_module libexec/apache2/libphp7.so
in that line you have to override with your new php72 path: in my case it was
LoadModule php7_module /usr/local/Cellar/php#7.2/7.2.31_1/lib/httpd/modules/libphp7.so
And restart apache, it works fine.
try this
brew install homebrew/php/php71-intl
I have successfully installed Laravel, but after running php artisan serve and going to localhost:8000 I get this error:
Use of undefined constant MCRYPT_RIJNDAEL_128 - assumed 'MCRYPT_RIJNDAEL_128'
I have checked phpinfo() on localhost:8888 and it says that mcrypt is properly installed. However the only thing I can think of is that maybe my path is wrong?
in my .bash_profile I have
PATH=/usr/local/bin:$PATH
Every time I try to run Laravel commands I have to type this in the terminal:
export PATH="~/.composer/vendor/bin:$PATH"
I am running on a Mac. Is there a simple way I can set up my bash_profile so that I can consistently change between localhost addresses and still have all the proper PHP functions working?
More simple way on ubuntu
apt-get install php5-mcrypt
mv -i /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available/
php5enmod mcrypt
service apache2 restart
Note: if you don't have "/etc/php5/conf.d" just skip that step and it will work ok
check http://php.net/manual/en/mcrypt.installation.php
This problem relative to the PHP extensions loader.
You no need to use laravel command at all after successful installation.
Laravel framework need Mcrypt Library for the security module and encrypt some of configure file.
The things that you need is theses steps.
Download Mcrypt http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz/download
then configure make and install it.
Download php http://php.net/releases/index.php
Above 5.5.14 are suggested. (Use this path later on step 4)
then download Autoconfigure
curl -O http://ftp.gnu.org/gnu/autoconf/autoconf-latest.tar.gz
tar xvfz autoconf-latest.tar.gz
cd autoconf-2.69/
./configure
make
sudo make install
then you have to go to directory level
cd ***YOURPHPDIRECTORY***/ext/mcrypt/
and run phpize within this directory level
/usr/bin/phpize
./configure
make
sudo make install
modify your php.ini to enable the mcrypt extension by insert this into php.ini
extension=mcrypt.so
Restart web server.
For Mac users's specially - install it using Home Brew
I’ve installed an empty Laravel installation and got the following error message when navigating to http://localhost/kanban/public/:
Notice: Use of undefined constant MCRYPT_RIJNDAEL_128 – assumed ‘MCRYPT_RIJNDAEL_128′ in /Library/WebServer/Documents/xxx/config/app.php on line 83
Googling for this error message return many tutorials on how to install mcrypt on Mac OS X (whether building it from source or using Homebrew). The problem was that both the mcrypt and the php55-mcrypt packages were properly installed:
$ brew install mcrypt
Warning: mcrypt-2.6.8 already installed
$ brew install php55-mcrypt
Warning: php55-mcrypt-5.5.20 already installed
Mcrypt was also properly loaded by PHP:
$ php -m | grep mcrypt
mcrypt
$ php -i | grep mcrypt
Additional .ini files parsed => /usr/local/etc/php/5.5/conf.d/ext-mcrypt.ini,
Registered Stream Filters => zlib.*, bzip2.*, convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk, mcrypt.*, mdecrypt.*
mcrypt
mcrypt support => enabled
mcrypt_filter support => enabled
mcrypt.algorithms_dir => no value => no value
mcrypt.modes_dir => no value => no value
for more details refer this link - http://benohead.com/mac-os-x-php-notice-use-undefined-constant-mcrypt_rijndael_128/
If you are seeing this on ubuntu or other flavors of *nix , it might help to do the following:
service php5-fpm restart
I just adjusted the .bash_profile in MacOS and it worked:
export PATH="/usr/local/sbin:$PATH"
PHP_AUTOCONF="/usr/local/bin/autoconf"
source ~/.bash_aliases
I also had this problem in trying to deploy a Laravel to Apache on Mac OS Sierra. I eventually found this post that gave step-by-step instructions to resolve this issue. These instructions assume that you have Homebrew installed; if you don't have it installed, then paste the following into a Terminal window to install it:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Here is the relevant steps pasted from the post given above:
Step 1: Install autoconf and mcrypt
I used homebrew to install autoconf and mcrypt, which is as easy as:
brew install autoconf mcrypt
If this does not work for you, or you don't want to use homebrew, then check out this tutorial.
Step 2: Build the PHP extension
To build the PHP extension you will need the PHP 5.4.17 source code that is available for download here and extract it:
cd ~/Downloads
unzip PHP-5.4.17.zip
Then build the extension using the following commands:
cd php-src-PHP-5.4.17/ext/mcrypt/
/usr/bin/phpize
./configure
make
sudo make install
Step 3: Enable the extension
All that is left is to enable the extension by editing /etc/php.ini. If this file is not present, copy /etc/php.ini.default and rename it:
sudo cp /etc/php.ini.default /etc/php.ini
Edit the /etc/php.ini file and add the following:
extension=mcrypt.so
Step 4: Restart apache
Now just restart apache and you're done!
sudo apachectl restart
ADDITIONAL NOTES AND CLARIFICATION
I did encounter two issues with following these steps:
I had to match the PHP zip file that I downloaded to the version of PHP that was installed on my machine.
So I did
php -v
to determine the version number and then changed the download to match that version number. In my case the PHP version was 5.6.28 and so I needed to download the PHP source from
https://github.com/php/php-src/archive/PHP-5.6.28.zip
I got an exception at step 2 when I tried to do the sudo make install, the exception was caused by SIP, a security featured added by El Capitan. The exception is outlined in this question, and the resolution to this problem I found in this answer.
Applying the information from this answer changed the step 2 listed above and replaced the sudo make install with the following:
mkdir -p /usr/local/lib/php/extensions
sudo make EXTENSION_DIR='/usr/local/lib/php/extensions' install
Take note that because of this change, step 4 above also needs to changed to include the path to mcrypt.so. So the following must go in the php.ini:
extension=/usr/local/lib/php/extensions/mcrypt.so
I use nginx and php-fpm, and already did apt-get install php5-mcrypt, and moved the mcrypt.ini file to mods-available.
I had to do sudo service php5-fpm restart before it actually worked.
detailed instructions here https://www.php.net/manual/en/install.pecl.windows.php
make sure you choose appropriate extension version as of your PHP version
I installed the php redis extension. But when I run the test code, I got the following error:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/redio.so' - /usr/lib/php5/20090626+lfs/redio.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Fatal error: Class 'Redis' not found in /var/www/test/redisTest.php on line 2
My php version is 5.3.10, I installed the new version of phpredis.
May I get your help?
THANKS!
The install steps are:
git clone https://github.com/nicolasff/phpredis.git
cd phpredis
phpize
make
make install
Then add a config file in /etc/php5/fpm/confi.d to load redis.so
I use PHP 5.3 and installing PHP-Redis using below steps worked just fine for me:
Install pecl extensionsudo pecl install redis
In php.ini, you may need set extension_dir to correct value. (can be usr/lib64/php/modules as above command placed the redis.so in this directory). In my case, I didn't set this.
Add below line to php.ini:extension=redis.so
Restart Apache/PHP-FPM
To verify if you have got redis installed you can do this
php -m | grep redis
Create a file PHP with echo phpinfo(); in it and see if the module is showing up. If you do not see the module then it is not being loaded correctly.
In the PHP5.3 and Amazon Linux AMI (Same as Centos OS 5)
install libs
yum install php-pear php-devel make gcc wget
install redis
cd /opt/
mkdir /opt/redis
wget https://redis.googlecode.com/files/redis-2.6.14.tar.gz "or last version"
tar -zxvf redis-2.6.14.tar.gz
cd redis-2.6.14
make
make install
install php-redis by pecl
pecl install redis
configuration option "php_ini" is not set to php.ini location
You should add "extension=redis.so" to php.ini
reload the web service httpd
service httpd reload
verify that the extension has been installed
php -m
[PHP Modules]
bz2
...
**redis**
...
[Zend Modules]
Download the proper library file according to your server environment( ex. x86). also, check for your PHP is thread-safe or not and download the Redis library accordingly. then place the library file inside the extension folder. you need to mention the library inside your php.ini as given below.
extension=redis.dll
then restart the server once, and check it's working properly or not.
if you have command line PHP, you can check it in the command line PHP as,
php r("print_r(get_loaded_extensions());")
I'm having a terribly difficult time getting the command "pg_connect()" to work properly on my Mac. I'm currently writing a PHP script (to be executed from console) to read a PostgreSQL database and email a report.
I've gone into my php.ini file and added
extension=pgsql.so
But, I'm met with the following error.
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20090626/php_pgsql.so' - dlopen(/usr/lib/php/extensions/no-debug-non-zts-20090626/php_pgsql.so, 9): image not found in Unknown on line 0
PHP Fatal error: Call to undefined function pg_connect() in... (blah file here)
When running phpinfo(), I see nothing about PostgreSQL, so what is my issue here?
The PHP version that comes bundled with OS X doesn't include PostgreSQL. You'll have to compile the extension yourself. Here are some instructions:
Find your version of PHP: php -v.
Download the version of PHP that matches yours: curl -O http://us.php.net/distributions/php-5.3.3.tar.gz. (This example downloads PHP 5.3.3 but this must match your version)
Extract the archive you downloaded: tar -xzvf php-5.3.3.tar.gz
Change to the PostgreSQL's extension directory: cd php-5.3.3/ext/pgsql/
Type phpize.
Type ./configure.
Type make.
Type sudo make install.
Add the extension to you php.ini file by adding extension=pgsql.so. (You may already have done this)
Restart Apache.
Update for OS X Mountain Lion
Apple has removed autoconf from the newer versions of XCode so the procedure above will fail at #5. To solve that problem:
Type /usr/bin/ruby -e "$(/usr/bin/curl -fksSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)".
Type sudo chown -R $USER /usr/local/Cellar.
Type brew update.
Type brew install autoconf.
That should install autoconf and allow you to install the module using the instructions above.
If you use home brew, you can solve this with a command as simple as:
brew install php55-pdo-pgsql
for other php version, search with:
brew search pgsql
This worked for me with OSX 10.9.4 «Mavericks»
Install sources
Download the PHP source code. Unlike on Mountain Lion, you don’t get any headers preinstalled to link against so need to put it in /usr/include/php. Mavericks ships with PHP 5.4.17, but the latest 5.4.x source from php.net should do:
tar -jxvf php-5.4.20.tar.bz2
sudo mkdir -p /usr/include
sudo mv php-5.4.20 /usr/include/php
Configure PHP
cd /usr/include/php
./configure --without-iconv
sudo cp /etc/php.ini.default /etc/php.ini
Building a module
I needed the pdo_pgsql module - the same pattern should apply to just about any module assuming you have the necessary dependencies installed:
cd ext/pdo_pgsql
In my case I had the following error:
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script. ERROR:
`phpize' failed
So I had to use this command:
brew install autoconf
Then:
phpize
After that I tried to do:
./configure
but I had the next problem:
checking for pg_config... not found configure: error: Cannot find
libpq-fe.h. Please specify correct PostgreSQL installation path
So the solution was to specify correct PostgreSQL installation path:
./configure --with-pdo-pgsql=/Library/PostgreSQL/9.3/
make
sudo make install
That copies pdo_pgsql.so to /usr/lib/php/extensions/no-debug-non-zts-20100525.
Then simply add
extension=pdo_pgsql.so to /etc/php.ini
Run php -m to confirm everything went to plan.
For those who installed php7/ngix/postgres with homebrew
You can install the PostgreSQL module with:
brew install php70-pdo-pgsql
After that, you have to restart the php service:
brew services restart php70
OS X El Capitan users can simply upgrade their version of PHP 5.6. This is a one liner that will do that.
curl -s http://php-osx.liip.ch/install.sh | bash -s 5.6
For php56 via brew:
brew install php56-pdo-pgsql
PostgreSQL by default is installed in a unusual place on MAC OS X:
/Library/PostgreSQL/9.3
Given the location above you can type this:
./configure --with-pgsql=/Library/PostgreSQL/9.3
I killed the whole day trying to make it work on El Capitan after I made an upgrade yesterday and it turned out that I forgot to modify httpd.conf and change the path from the default php module (version 5.5.27) to the one I installed (version 5.6.14). This should be done in httpd.conf by modifying your default LoadModule php5_module path to LoadModule php5_module /usr/local/opt/php56/libexec/apache2/libphp5.so.
Just decided to leave it here as the potential solution for those who upgrade their OS or just the PHP version and face the same problem.
For those of you having openssl error while make here is the solution
OSX uses openssl 0.98 while installer is searching for 1.0.0
refer this link for instructions
psycopg2 installation error - Library not loaded: libssl.dylib
I downloaded PostgreSQL for Mac, and used the stack builder after installation to standup the entire EnterpriseDB Apache/PHP stack end-to-end. I mention this as a possible time saving option, probably not ideal for all situations. Should work OK if the apache and postgres shipped with Mac OS X were never started.
To keep existing apache hosted applications (i.e. pre-PostgreSQL install legacy) stable, I would just install the newer EnterpriseDB apache on port 81 (stackbuilder will prompt for new port if legacy apache instance is already running). Then, use mod_proxy in httpd.conf for the apache running on port 80 to provide seamless user experience to applications hosted on PostgreSQL.