# php-pdo_mysql installation error



## sinbad (Aug 7, 2012)

I'm trying to install php 5.4.5 on apache and it failed with the following error when I test it:


```
# php
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20100525-debug/pdo_mysql.so' - /usr/local/lib/php/20100525-debug/pdo_mysql.so: Undefined symbol "mysqlnd_debug_std_no_trace_funcs" in Unknown on line 0
```

searching google turns out a bug listed on php.net



> When building the MySQL extensions you explicitly have to enable mysqlnd. i.e. --enable-mysqlnd=shared. If you build mysqlnd shared you have to remember to load it, too.



but it looks as mysqlnd already checked in the make config .
it also adds the corresponding extensions in my /usr/local/etc/php/extensions.ini 

```
extension=pdo.so
extension=pdo_mysql.so
```

php info file shows:

```
Environment:
PWD 	/usr/ports/databases/php5-pdo_mysql


PDO drivers - sqlite 
PDO Driver for SQLite 3.x - SQLite Library 	3.7.13
```


Steps I did:

```
[/usr/ports/lang/php5]# make install clean

[/usr/ports/database/php5-pdo]# make install clean

[/usr/ports/database/php5-pdo_mysql]# make install clean

[/]# apachectl stop
[/]# apachectl start
```

anyone knows what I can try please?


```
#uname -a
FreeBSD 9.0-RELEASE-p3 FreeBSD 9.0-RELEASE-p3 #0: Tue Jun 12 01:47:53 UTC 2012     root@i386-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  i386
```



```
#php -v
PHP 5.4.5 (cli) (built: Aug  6 2012 21:59:58) (DEBUG)
```


----------



## SirDice (Aug 7, 2012)

Make sure MYSQLND is turned on in databases/php5-pdo_mysql.


----------



## sinbad (Aug 7, 2012)

yes it is enabled by default.


----------



## SirDice (Aug 7, 2012)

Do you have anything in /etc/make.conf that might interfere?


----------



## sinbad (Aug 7, 2012)

the only content I have is (did portupgrade -a today)

```
#added by use.perl 2012-08-07 08:18:08
PERL_VERSION=5.8.9
```


----------



## sinbad (Aug 7, 2012)

forgot to mention 

```
pkg_version -v
```
returns all packages are up to date.


----------



## busoluv (Aug 7, 2012)

*I have the same issue*

I have been fighting the same issue since yesterday.  Oddly, over the weekend, I switched another FreeBSD 9.0 client to the newest pdo_mysql and all was fine.  Yesterday, upon arriving at the office and attempting to update a production machine, I received the error listed by sinbad.

I have run through *make install clean*s, *portupgrade --all*, and even went so far as to *make deinstall* php5, php5-extensions, and php5-pdo_mysql, then go through the filesystem and remove all leftover php5 lib directories, and then do a *make* and *make install* on all packages.

Still the same problem.  I can upload any files that anyone would care to take a look at.

Thanks in advance for your help.


----------



## busoluv (Aug 8, 2012)

Good Morning, or evening depending on where you are.  Has anyone else seen this problem?  I, unfortunately, am a bit of a FreeBSD novice, so I do not know where to compare between two systems, one that works and one that does not, but I DO have one 9.0 system from this weekend that works and one 9.0 system from Monday that does not.

If anyone has any ideas, I would be happy to post the differences between the two systems in an effort to troubleshoot.

Thanks!


----------



## sinbad (Aug 8, 2012)

i rolled back to php 5.3 and now the pdo extensions loads fine. not a fix for 5.4.5 issue but at least I can install my applications now.


----------



## busoluv (Aug 8, 2012)

Just in case anyone sees an issue, here are the installed packages, grepping for php and apache:

[DOES NOT WORK]

php5-5.4.5                          =   up-to-date with port
php5-bz2-5.4.5                      =   up-to-date with port
php5-ctype-5.4.5                    =   up-to-date with port
php5-curl-5.4.5                     =   up-to-date with port
php5-dom-5.4.5                      =   up-to-date with port
php5-exif-5.4.5                     =   up-to-date with port
php5-extensions-1.7                 =   up-to-date with port
php5-filter-5.4.5                   =   up-to-date with port
php5-gd-5.4.5                       =   up-to-date with port
php5-hash-5.4.5                     =   up-to-date with port
php5-iconv-5.4.5                    =   up-to-date with port
php5-json-5.4.5                     =   up-to-date with port
php5-mcrypt-5.4.5                   =   up-to-date with port
php5-mysql-5.4.5                    =   up-to-date with port
php5-mysqli-5.4.5                   =   up-to-date with port
php5-openssl-5.4.5                  =   up-to-date with port
php5-pdo-5.4.5                      =   up-to-date with port
php5-pdo_mysql-5.4.5                =   up-to-date with port
php5-pdo_sqlite-5.4.5               =   up-to-date with port
php5-phar-5.4.5                     =   up-to-date with port
php5-posix-5.4.5                    =   up-to-date with port
php5-session-5.4.5                  =   up-to-date with port
php5-simplexml-5.4.5                =   up-to-date with port
php5-soap-5.4.5                     =   up-to-date with port
php5-sqlite3-5.4.5                  =   up-to-date with port
php5-tokenizer-5.4.5                =   up-to-date with port
php5-xml-5.4.5                      =   up-to-date with port
php5-xmlreader-5.4.5                =   up-to-date with port
php5-xmlrpc-5.4.5                   =   up-to-date with port
php5-xmlwriter-5.4.5                =   up-to-date with port
php5-zip-5.4.5                      =   up-to-date with port
php5-zlib-5.4.5                     =   up-to-date with port
apache-2.2.22_6                     =   up-to-date with port


[WORKS]

php5-5.4.5                         =   up-to-date with port
php5-bcmath-5.4.5                  =   up-to-date with port
php5-bz2-5.4.5                     =   up-to-date with port
php5-calendar-5.4.5                =   up-to-date with port
php5-ctype-5.4.5                   =   up-to-date with port
php5-curl-5.4.5                    =   up-to-date with port
php5-dom-5.4.5                     =   up-to-date with port
php5-extensions-1.7                =   up-to-date with port
php5-fileinfo-5.4.5                =   up-to-date with port
php5-filter-5.4.5                  =   up-to-date with port
php5-gd-5.4.5                      =   up-to-date with port
php5-gettext-5.4.5                 =   up-to-date with port
php5-hash-5.4.5                    =   up-to-date with port
php5-iconv-5.4.5                   =   up-to-date with port
php5-json-5.4.5                    =   up-to-date with port
php5-mcrypt-5.4.5                  =   up-to-date with port
php5-mysql-5.4.5                   =   up-to-date with port
php5-mysqli-5.4.5                  =   up-to-date with port
php5-openssl-5.4.5                 =   up-to-date with port
php5-pdo-5.4.5                     =   up-to-date with port
php5-pdo_mysql-5.4.5               =   up-to-date with port
php5-pdo_sqlite-5.4.5              =   up-to-date with port
php5-phar-5.4.5                    =   up-to-date with port
php5-posix-5.4.5                   =   up-to-date with port
php5-session-5.4.5                 =   up-to-date with port
php5-simplexml-5.4.5               =   up-to-date with port
php5-soap-5.4.5                    =   up-to-date with port
php5-sockets-5.4.5                 =   up-to-date with port
php5-sqlite3-5.4.5                 =   up-to-date with port
php5-tidy-5.4.5                    =   up-to-date with port
php5-tokenizer-5.4.5               =   up-to-date with port
php5-xml-5.4.5                     =   up-to-date with port
php5-xmlreader-5.4.5               =   up-to-date with port
php5-xmlrpc-5.4.5                  =   up-to-date with port
php5-xmlwriter-5.4.5               =   up-to-date with port
php5-zip-5.4.5                     =   up-to-date with port
php5-zlib-5.4.5                    =   up-to-date with port
phpeclipse-1.2.3_5                 =   up-to-date with port
apache-2.2.22_5                    =   up-to-date with port
apache-ant-1.8.3_1                 =   up-to-date with port


I note that the only real difference is Apache 2.2.22_5 on the working installation and 2.2.22_6 on the non-working installation, at least among this limited list.


----------



## busoluv (Aug 8, 2012)

I also note that, whereas the non-working system reports the error here:

     /usr/local/lib/php/20100525-debug/pdo_mysql.so
-r--r--r--  1 root  wheel  52004 Aug  8 18:51 pdo_mysql.so

and that is where the file exists, under the working system, the path that exists for /usr/local/lib/php... is:

     /usr/local/lib/php/20100525/pdo_mysql.so
-r--r--r--  1 root  wheel  32309 Aug  3 19:08 pdo_mysql.so


Unfortunately, these two systems are different, one being a XenServer Vm and another being a live server, but I thought I would try to copy the library between servers, since they are both amd64.  This errored, as expected:

     PHP Warning:  PHP Startup: pdo_mysql: Unable to initialize module
                                                                  Module compiled with build ID=API20100525,NTS
                                                                  PHP    compiled with build ID=API20100525,NTS,debug
                                                                  These options need to match
                                                                  in Unknown on line 0


----------



## busoluv (Aug 13, 2012)

Hello, just wondering if anyone else has this issue.  I have done a portsnap fetch update on several occasions.  Even, though I haven't seen an update to lang/php5, I have been occasionally make deinstalling lang/php5, lang/php5-extensions, and www/apache22, then doing a make distclean and make clean install clean. 

The same issue exists.  Is there a way I could easily turn off debug to see if that solves the problem for a recompile?

Thanks!


----------



## busoluv (Aug 15, 2012)

I went ahead and removed the DEBUG and it solved the problem.  I am always worried about editing Makefiles in another person's configuration but, fortunately, it was even simpler than I imagined.  You can ignore the Makefile for all of the extensions, and just remove DEBUG from the Makefile for php5.

Look for this line in /usr/ports/lang/php5/Makefile:

     OPTIONS_DEFINE= CLI CGI FPM APACHE AP2FILTER DEBUG EMBED DTRACE IPV6 MAILHEAD LINKTHR 

and simply remove the "DEBUG" to make this:

     OPTIONS_DEFINE= CLI CGI FPM APACHE AP2FILTER EMBED DTRACE IPV6 MAILHEAD LINKTHR 

"make deinstall" php5, php5-extensions, and php5-pdo_mysql, "make distclean" them, then "make clean install clean" php5, php5-extensions, and php5-pdo_mysql.

Bingo, working copy of PHP 5.4.5 with pdo_mysql.  I hope this helps anyone who may be encountering this problem, and I will try not to shy away from editing FreeBSD Makefiles in the future if necessary.


----------



## jaxxed (Oct 2, 2012)

the only problem with editing the Makefile is that your changes go away on the next update (portsnap/cvsup etc)

I have the same problem, but I note that the make config for the php5 port includes a debug checkbox.  I am now trying to compile with debug disabled.


----------



## busoluv (Oct 3, 2012)

Subsequent updates of ports seem to have solved the problem, so if you are doing an update now, it should work correctly.


----------

