# Mysql PDO Driver



## Palleas (Sep 16, 2009)

Hi there,

I'm trying to install the MySQL driver for PDO, so I did that :

pkg_add php5-pdo_mysql

I had a few warnings :

```
[root@server]/usr/local/bin(191): pkg_add -r php5-pdo_mysql
Fetching ftp://ftp.fr.freebsd.org/pub/FreeBSD/ports/i386/packages-current/Latest/php5-pdo_mysql.tbz... Done.
pkg_add: warning: package 'php5-pdo_mysql-5.2.10' requires 'pkg-config-0.23_1', but 'pkg-config-0.22_1' is installed
pkg_add: warning: package 'php5-pdo_mysql-5.2.10' requires 'mysql-client-5.0.85', but 'mysql-client-5.0.45_1' is installed
pkg_add: warning: package 'php5-pdo_mysql-5.2.10' requires 'libiconv-1.13.1', but 'libiconv-1.11_1' is installed
pkg_add: warning: package 'php5-pdo_mysql-5.2.10' requires 'libxml2-2.7.3_1', but 'libxml2-2.6.30' is installed
pkg_add: warning: package 'php5-pdo_mysql-5.2.10' requires 'php5-5.2.10', but 'php5-5.2.5' is installed
pkg_add: warning: package 'php5-pdo_mysql-5.2.10' requires 'php5-pdo-5.2.10', but 'php5-pdo-5.2.5' is installed
```

As I'm not the one who installed this server and as I don't know anything avout FreeBsd, I'm kind of lost...
AT the end of my php.ini file, there is "extension=pdo_mysql.so" which mean the installation succeed, but if try a "php -i" I get this error :

```
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20060613/pdo_mysql.so' - Shared object "libz.so.5" not found, required by "pdo_mysql.so" in Unknown on line 0
```

Can anybody help me ?

Thanks !


----------



## Carpetsmoker (Sep 17, 2009)

Where did you get the package from? And which version of FreeBSD are you running? Post the output of: `% uname -a`.


----------



## Palleas (Sep 17, 2009)

About the package, I must admit I really don't know where it come from, I tried a "Make Install" in my /usr/ports/?/php5-pdo_mysql but it failed.
I also tried a pkg_add php5-pdo_mysql (the package seemed to come from "ftp://ftp.fr.freebsd.org/pub/FreeBSD/ports/i386/packages-current/Latest/").

Output of "uname -a" :
"FreeBSD [servername] 6.3-RELEASE FreeBSD 6.3-RELEASE #0: Wed Jan 16 04:18:52 UTC 2008     root@dessler.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386"

Thanks !


----------



## Carpetsmoker (Sep 17, 2009)

> I also tried a pkg_add php5-pdo_mysql (the package seemed to come from "ftp://ftp.fr.freebsd.org/pub/FreeBSD/ports/i386/packages-current/Latest/").



That package is for FreeBSD 8. It will not work on FreeBSD 6.

Packages for FreeBSD 6.3 are no longer available on the FreeBSD website(ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/), only FreeBSD 6.4 and 6-STABLE. You could try one of these, they may or may not work.



> I tried a "Make Install" in my /usr/ports/?/php5-pdo_mysql but it failed.



What went wrong with the ports installation?

As a general note, it may be best to upgrade PHP altogether, in my personal experience installingen a module with a few version numbers newer than the main PHP lib works fine, but this isn't supported by the PHP people.


----------



## Palleas (Sep 17, 2009)

I don't remember the errors I got with the Make Install, it as something like "mysql_client is already installed, try to reinstall ...".



> As a general note, it may be best to upgrade PHP altogether, in my personal experience installingen a module with a few version numbers newer than the main PHP lib works fine, but this isn't supported by the PHP people.



You're totally right, to be honnest it's a shame it hasn't been done but that's the first time I take a look at our server ... :/
I'm more confortable w/ Ubuntu, can you tell me how to upgrade php altogether ?

Thanks!


----------



## Carpetsmoker (Sep 17, 2009)

Well, there are a few methods. I prefer to do it manually.


```
pkg_delete php\*
# cd /usr/ports/lang/php5-extensions
# make config
[select extensions you need]
# make clean install clean
```

Other people prefer portupgrade or portmaster, portmaster is useful at times. I don't like portupgrade. To be fair, many people are going to disagree with me on that one though.

--

If you had errors with mysql_client then maybe your mysql client is broken, out of date, or you're trying to install multiple versions of mysql_client (i.e. 5.0 and 5.1).

Try building php5-pdo_mysql and post the error,


----------



## Palleas (Sep 17, 2009)

portmaster and portupgrade are not installed anyway :/

All my coworker are working on the server right know, I'll try at lunch and I'll post my results here.

Thanks for your help !


----------



## Carpetsmoker (Sep 17, 2009)

You can install them from /usr/ports/ports-mgmt/
portupgrade required ruby which is usually not installed, but portmaster is just a shell script. It has no dependencies and can be installed on any machine.


----------



## jaxxed (Oct 2, 2012)

http://forums.freebsd.org/showthread.php?t=33817

There are some preliminary findings that having 'debug' enabled in the php5 port can give this error. Rather, there are some reports that removing that flag, eliminates the problem.


----------



## jaxxed (Oct 2, 2012)

The bz2 error probably means that you don't have the php bz libraries installed or enabled (in [/usr/local/etc/] php/extensions.ini.  the package is php5_bz2 , and the port is in archivers/php5-bz2


----------

