简体   繁体   English

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

[英]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: 我正在尝试安装PHP 5.6,并且与我合作的较旧站点之一需要运行时未安装的mysql扩展:

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. 它安装了php56,并且一切正常,但是它安装了mysqli扩展,但是我也需要mysql扩展。

Is there a way to install this extension to my current php setup? 有没有办法将此扩展安装到我当前的php设置中?

Here is the currently installed php extensions that I have: 这是我当前安装的php扩展:

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! 只是想知道,谢谢!

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. 根据homebrew installer 选项 ,这将安装旧的mysql驱动程序, 而不是较新的本机驱动程序。 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 我最终使用以下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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM