Vortex
Vortex

Reputation: 816

How to install php 5.6 mysql extension on Mac OSX

I am trying to setup PHP 5.6 and one of the older sites that I work with needs the mysql extension which didn't install when I ran:

brew install php56 --with-fpm --with-mysql --with-httpd

It installed php56 and that's all working fine however it installed the mysqli extension but I need the mysql extension too.

Is there a way to install this extension to my current php setup?

Here is the currently installed php extensions that I have:

5.6 php -m
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dba
dom
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
intl
json
ldap
libxml
mbstring
mongodb
mysqli
mysqlnd
odbc
openssl
pcntl
pcre
PDO
pdo_mysql
PDO_ODBC
pdo_sqlite
Phar
posix
readline
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xdebug
xml
xmlreader
xmlrpc
xmlwriter
xsl
zip
zlib

[Zend Modules]
Xdebug

Just wondering, thanks!

Upvotes: 3

Views: 7649

Answers (2)

Vortex
Vortex

Reputation: 816

I ended up finding the solution using the following https://github.com/Homebrew/homebrew-php/issues/4501

You can do the following:

just copy in /usr/local/lib:

libmysqlclient.a -> libmysqlclient_r.a
libmysqlclient.dylib -> libmysqlclient_r.dylib
try to install php with:
brew install php56 --with-libmysql --with-httpd --with-pear --build-from-source

Upvotes: 2

Derek Brown
Derek Brown

Reputation: 4419

Try the following:

brew reinstall php56 --with-fpm --with-libmysql --with-httpd

Per the homebrew installer options, this installs the old mysql driver instead of the newer native driver. I don't think there is any way to install both simultaneously as the drivers conflict.

If this is a new project you are working on, it may be worth the time to refactor your project to use the native driver.

Upvotes: 2

Related Questions