Upgrade PHP with PostgreSQL connect support
$ brew install php56 --with-postgresql [--with-httpd]
doesn't work for my, so I try to compile manually from source.
$ ./configure --prefix=/usr/local/Cellar/php/7.2.2 --with-pgsql=/usr/local/Cellar/postgres/10.2
This compile successfully, but I am not replacing the old php on the system, the apache always load the old php version. I need libphp.so (libphp5.so or libphp7.so) for apache to locate the new php.
$ ./configure --prefix=/usr/local/Cellar/php/7.2.2 --with-pgsql=/usr/local/Cellar/postgres/10.2 --with-apxs2=`which apxs`
(apxs command is from Apache)
This fail.
1. undefined symbol _lo_lseek64()
- error from PostgreSQL, some issue with the configuration, I link it to libpq.a to solve.
2. undefined symbol _SSL_XXX
- link openssl-1.1, which is an older version on my system
3. Disable GSSAPI on Postgresql
- $ brew edit postgresql, delete --with-gssapi
- $ brew reinstall postgresql
You might not experience all the 3 issues.
$ edit php-7.2.2/Makefile
For a quick hack, I just add in MH_BUNDLE_FLAGS =
either -L/usr/local/Cellar/postgresql/10.2 -lpq or /usr/local/Cellar/postgresql/10.2/lib/libpq.a
openssl
-L/usr/local/Cellar/openssl@1.1/lib -lcrypto -lssl
or
/usr/local/Cellar/openssl@1.1/lib/libcryptio.a /usr/local/Cellar/openssl@1.1/lib/libssl.a
My system is Mac OS X 10.9 Mavericks, Homebrew. I have tried compiling php-5.6 and php-7.2, both seems ok for me. I try php7.
$ cp libs/libphp7.so /usr/local/libexec
# LoadModule php5_module libexec/apache2/libphp5.so
LoadModule php5_module /usr/local/libexec/libphp5.so
LoadModule php7_module /usr/local/libexec/libphp7.so
$ sudo apachectl -M
...
rewrite_module (shared)
php5_module (shared)
php7_module (shared)
hfs_apple_module (shared)
Syntax OK
$ sudo apachectl start
$ curl http://localhost/php/phpinfo.php
()