如何在Mac OSX上安装php 5.6 mysql扩展

如何在Mac OSX上安装php 5.6 mysql扩展

问题描述:

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!

我正在尝试设置PHP 5.6,并且我使用的旧网站之一需要mysql扩展,而且没有' 我运行时安装: p>

  brew install php56 --with-fpm --with-mysql --with-httpd 
  code>  pre> 
  
 

它安装了php56,并且一切正常但是它安装了mysqli扩展但我也需要mysql扩展。 p>

有没有办法将此扩展安装到我当前的php setup? p>

这是我目前安装的php扩展: p>

  5.6 php -m 
 [PHP Modules] 
bcmath  
bz2 
calendar \ NCORE 
ctype 
curl 
date \ NDBA 
dom 
exif 
fileinfo 
filter 
ftp \ NGD 
gettext 
hash 
iconv 
intl 
json \ NLDAP 
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 \ NSPL 
sqlite3 
标准
sysvmsg 
sysvsem 
sysvshm 
tokenizer 
wddx 
xdebug  
xml 
xmlreade  r 
 
xmlrpc 
xmlwriter 
xsl 
zip 
zlib 
 
 [Zend Modules] 
Xdebug 
  code>  pre> 
 
 

只是想知道,谢谢! p>

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.

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