tags:

views:

538

answers:

4

I'm having trouble finding documentation about how exactly to go about "turning on" mysqli. I'm running OS X SL and, as I understand it, since php5 is installed, the mysqli extension should already be there as well.

Is this as simple as adding a LoadModule line to php.ini? If I need to re-compile php, does anyone know of a good link where I could follow along to do that (so I don't goof anything up)?

Thanks in advance.

+2  A: 

PHP.net said:

As of PHP 5.0, MySQL support is no longer enabled by default with the standard PHP distributions.

You will need to configure PHP with MySQLi-support. Why don't take the safe (and probably best), object oriented, road and go with the PDO classes?

Björn
+1 for the suggestion of PDO
Yacoby
+1 Also for the suggestion of PDO. I'll be putting PDO to use as I develop in the future.
Anthony
+1  A: 

Save yourself the headache and install the entropy PHP package or MAMP. Getting all the commonly needed PHP modules working on OSX is non-trivial. Most people I know go with either one of those packages.

Asaph
I've heard of MAMP before and thought about using it... If i install it, though, am I then going to have duplicate apache/php/mysql installations on my machine? Is that going to mess with what's already there?
Anthony
I looked in to MAMP a bit and I think I'll be installing it and getting rid of this problem altogether. Thanks for the suggestion.
Anthony
A: 

If php5 was compiled with mysqli support already, then all you should need to do is point to that library in php.ini

extension=mysqli.so

After adding that you will probably need to restart apache.

Note: The filename for the mysqli library might differ on some platforms.

Kyril
A: 

I was trying to install the MediaWiki on Snow Leopard with MySQL 5.1.41, which needed this as well. After plenty of stumbling around, the solution was extremely simple...

In /etc/php.ini, change the following lines from:

pdo_mysql.default_socket = /var/mysql/mysql.sock mysql.default_socket = /var/mysql/mysql.sock mysqli.default_socket = /var/mysql/mysql.sock

to: pdo_mysql.default_socket = /tmp/mysql.sock mysql.default_socket = /tmp/mysql.sock mysqli.default_socket = /tmp/mysql.sock

While I had linked /tmp/mysql.sock to /var/mysql, this didn't kick in until I actually edited the file.

Manuel Mattke