How to install the mysqlnd driver with MAMP?

2019-07-04 21:22发布

问题:

Ive done a lot of online research, but I haven't found much on this, which I dont understand. But it seems that the mysql native driver doesn't come with the MAMP stack. For instance the mysqli get_result method doesn't work out of the box. I thought this was an error in my installation but after a clean reinstall the method still doesn't work, so apparently the driver is not install. It seems weird that there is so little material on the topic because a lot of people must be testing local with get_result?
So it comes down to this: how do i manage to install the mysqlnd driver? :-)

PHP.INI:

;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;
;
; If you wish to have an extension loaded automatically, use the following
; syntax:
;
;   extension=modulename.extension
;
; For example, on Windows:
;
;   extension=msql.dll
;
; ... or under UNIX:
;
;   extension=msql.so
;
; Note that it should be the name of the module only; no directory information
; needs to go here.  Specify the location of the extension with the
; extension_dir directive above.


; Extensions

;extension=apcu.so

extension=imap.so
extension=yaz.so
extension=mcrypt.so
extension=gettext.so
extension=pgsql.so
extension=pdo_pgsql.so
extension=pdo_mysql.so

;extension=imagick.so
;extension=tidy.so
;extension=oauth.so

回答1:

Which PHP version are you using ?

In PHP 5.5 the MySQL original extension was deprecated [1]. MAMP distribution should deleted it from it's base.

Try to use mysqli extension, or you should migrate to pdo_mysql extension.

There it's a converter to change from mysql extension to mysqli one: https://wikis.oracle.com/display/mysql/Converting+to+MySQLi

[1] http://php.net/manual/en/migration55.deprecated.php