9

I'm getting this error when I try to start PHP via command line:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/pdo_odbc.so' - /usr/lib64/php/modules/pdo_odbc.so: undefined symbol: pdo_parse_params in Unknown on line 0

Here are the PHP packages I have installed:

php.x86_64                      5.5.7-1.fc20        @updates                    
php-ZendFramework.noarch        1.12.3-3.fc20       @updates                    
php-bcmath.x86_64               5.5.7-1.fc20        @updates                    
php-cli.x86_64                  5.5.7-1.fc20        @updates                    
php-common.x86_64               5.5.7-1.fc20        @updates                    
php-devel.x86_64                5.5.7-1.fc20        @updates                    
php-gd.x86_64                   5.5.7-1.fc20        @updates                    
php-mcrypt.x86_64               5.5.7-1.fc20        @updates                    
php-mssql.x86_64                5.5.7-1.fc20        @updates                    
php-odbc.x86_64                 5.5.7-1.fc20        @updates                    
php-pdo.x86_64                  5.5.7-1.fc20        @updates                    
php-pear.noarch                 1:1.9.4-23.fc20     @fedora                     
php-pecl-jsonc.x86_64           1.3.3-1.fc20        @updates                    
php-pecl-jsonc-devel.x86_64     1.3.3-1.fc20        @updates                    
php-process.x86_64              5.5.7-1.fc20        @updates                    
php-xml.x86_64                  5.5.7-1.fc20        @updates

I have extension=pdo_odbc.so and extension=oci8.so as the only extensions defined in my /etc/php.ini file. There are also a lot of .ini files in the /etc/php.d directory that loads most of the other extensions. The following .so files are in the /usr/lib64/php/modules directory:

-rwxr-xr-x. 1 root root   32560 Dec 10 23:51 bcmath.so
-rwxr-xr-x. 1 root root   24696 Dec 10 23:51 bz2.so
-rwxr-xr-x. 1 root root   33752 Dec 10 23:51 calendar.so
-rwxr-xr-x. 1 root root   15568 Dec 10 23:51 ctype.so
-rwxr-xr-x. 1 root root   86912 Dec 10 23:51 curl.so
-rwxr-xr-x. 1 root root  180608 Dec 10 23:51 dom.so
-rwxr-xr-x. 1 root root   65496 Dec 10 23:51 exif.so
-rwxr-xr-x. 1 root root 2713328 Dec 10 23:51 fileinfo.so
-rwxr-xr-x. 1 root root   53624 Dec 10 23:51 ftp.so
-rwxr-xr-x. 1 root root  120904 Dec 10 23:51 gd.so
-rwxr-xr-x. 1 root root   15640 Dec 10 23:51 gettext.so
-rwxr-xr-x. 1 root root   45080 Dec 10 23:51 iconv.so
-rwxr-xr-x. 1 root root   40840 Dec 12 09:13 json.so
-rwxr-xr-x. 1 root root   45256 Dec 10 23:51 mcrypt.so
-rwxr-xr-x. 1 root root   53816 Dec 10 23:51 mssql.so
-rwxr-xr-x. 1 root root  560751 Jan 10 10:20 oci8.so
-rwxr-xr-x. 1 root root   70312 Dec 10 23:51 odbc.so
-rwxr-xr-x. 1 root root   25008 Dec 10 23:51 pdo_dblib.so
-rwxr-xr-x. 1 root root   28856 Dec 10 23:51 pdo_odbc.so
-rwxr-xr-x. 1 root root  116240 Dec 10 23:51 pdo.so
-rwxr-xr-x. 1 root root   29168 Dec 10 23:51 pdo_sqlite.so
-rwxr-xr-x. 1 root root  272000 Dec 10 23:51 phar.so
-rwxr-xr-x. 1 root root   32880 Dec 10 23:51 posix.so
-rwxr-xr-x. 1 root root   15624 Dec 10 23:51 shmop.so
-rwxr-xr-x. 1 root root   54176 Dec 10 23:51 simplexml.so
-rwxr-xr-x. 1 root root   91368 Dec 10 23:51 sockets.so
-rwxr-xr-x. 1 root root   51336 Dec 10 23:51 sqlite3.so
-rwxr-xr-x. 1 root root   19880 Dec 10 23:51 sysvmsg.so
-rwxr-xr-x. 1 root root   11496 Dec 10 23:51 sysvsem.so
-rwxr-xr-x. 1 root root   15720 Dec 10 23:51 sysvshm.so
-rwxr-xr-x. 1 root root   19712 Dec 10 23:51 tokenizer.so
-rwxr-xr-x. 1 root root   36720 Dec 10 23:51 wddx.so
-rwxr-xr-x. 1 root root   32888 Dec 10 23:51 xmlreader.so
-rwxr-xr-x. 1 root root   54072 Dec 10 23:51 xml.so
-rwxr-xr-x. 1 root root   49152 Dec 10 23:51 xmlwriter.so
-rwxr-xr-x. 1 root root   37104 Dec 10 23:51 xsl.so

The output of when I run phpinfo() can be found here.

Contents of pdo_odbc.ini at /etc/php.d:

; Enable pdo_odbc extension module
extension=pdo_odbc.so

Output of readelf -Ws pdo_odbc.so:

Symbol table '.dynsym' contains 83 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 0000000000001ac0     0 SECTION LOCAL  DEFAULT    9 
     2: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND convert_to_long
     3: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND pdo_parse_params
     4: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND php_pdo_unregister_driver
     5: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND free@GLIBC_2.2.5 (2)
     6: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND strcasecmp@GLIBC_2.2.5 (2)
     7: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND _ITM_deregisterTMCloneTable
     8: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND SQLParamData
     9: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND cfg_get_string
    10: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND SQLRowCount
    11: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _estrdup
    12: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND strlen@GLIBC_2.2.5 (2)
    13: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND SQLFreeHandle
    14: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND SQLFetchScroll
    15: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND __stack_chk_fail@GLIBC_2.4 (3)
    16: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _zval_dtor_func
    17: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND SQLDriverConnect
    18: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND SQLPutData
    19: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND zend_fetch_resource
    20: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND strchr@GLIBC_2.2.5 (2)
    21: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND php_info_print_table_row
    22: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _php_stream_stat
    23: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND SQLGetDiagRec
    24: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND SQLDescribeCol
    25: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _erealloc
    26: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND php_pdo_get_exception
    27: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND zend_hash_index_find
    28: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND zend_declare_class_constant_long
    29: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND __gmon_start__
    30: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND SQLCloseCursor
    31: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND SQLSetEnvAttr
    32: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND php_error_docref0
    33: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND php_info_print_table_end
    34: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _safe_malloc
    35: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND memcpy@GLIBC_2.14 (4)
    36: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND SQLConnect
    37: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND zend_throw_exception_ex
    38: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND php_file_le_stream
    39: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND SQLDescribeParam
    40: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND php_info_print_table_header
    41: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND php_pdo_register_driver
    42: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND SQLColAttribute
    43: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND php_pdo_get_dbh_ce
    44: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND SQLPrepare
    45: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _ecalloc
    46: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND SQLSetConnectAttr
    47: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND __strcpy_chk@GLIBC_2.3.4 (5)
    48: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _convert_to_string
    49: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND SQLExecute
    50: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _efree
    51: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND SQLExecDirect
    52: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND zval_is_true
    53: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND SQLSetCursorName
    54: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND SQLDisconnect
    55: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND _Jv_RegisterClasses
    56: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _php_stream_read
    57: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND add_next_index_string
    58: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _estrndup
    59: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND SQLEndTran
    60: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _emalloc
    61: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND SQLNumResultCols
    62: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND SQLGetData
    63: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND php_file_le_pstream
    64: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _zval_copy_ctor_func
    65: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND _ITM_registerTMCloneTable
    66: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND SQLBindParameter
    67: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND SQLGetCursorName
    68: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND add_next_index_long
    69: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND SQLSetStmtAttr
    70: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND SQLAllocHandle
    71: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND php_info_print_table_start
    72: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND SQLBindCol
    73: 0000000000000000     0 FUNC    WEAK   DEFAULT  UND __cxa_finalize@GLIBC_2.2.5 (2)
    74: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND spprintf
    75: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND strstr@GLIBC_2.2.5 (2)
    76: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND SQLMoreResults
    77: 0000000000206438     0 NOTYPE  GLOBAL DEFAULT   23 _edata
    78: 0000000000206440     0 NOTYPE  GLOBAL DEFAULT   24 _end
    79: 0000000000002310     8 FUNC    GLOBAL DEFAULT   11 get_module
    80: 0000000000206438     0 NOTYPE  GLOBAL DEFAULT   24 __bss_start
    81: 0000000000001ac0     0 FUNC    GLOBAL DEFAULT    9 _init
    82: 00000000000045a4     0 FUNC    GLOBAL DEFAULT   12 _fini
Nathan Jones
  • 4,904
  • 9
  • 44
  • 70
  • Perhaps related to: https://askubuntu.com/questions/999999/php-with-pdo-mysql-in-ubuntu-16-04 – Jay M Oct 22 '19 at 23:14

2 Answers2

12

What solved my issue was removing the line extension=pdo_odbc.so from /etc/php.ini.

The pdo_odbc.so extension gets imported in the /etc/php.d/pdo_odbc.ini file, which also had extension=pdo_odbc.so in it.

Explanation

Nathan Jones
  • 4,904
  • 9
  • 44
  • 70
  • Not in my case, I've to add `/etc/php.d/pdo_odbc.ini` myself, instead of put it in `/etc/php.ini` – sulaiman sudirman Mar 15 '16 at 03:46
  • I installed odbc 13 for MSSQL but i am unable to find the extension pdo_odbc.so in `/usr/lib64/php/modules` nor I am able to find `/etc/php.d/pdo_odbc.ini` file. Is it that we need to manually copy `.so` file from some other path to `/usr/lib64/php/modules` and then create the `pdo_odbc.ini` file? – Mrudang Vora Mar 23 '17 at 04:12
  • 1
    Same principle + same fix may apply if anybody out there gets this error: `PHP Startup: Unable to load dynamic library 'pdo_pgsql'`. pgsql might already be loaded by pgsql.ini in the /etc/php* tree structure. – Fabien Haddadi Sep 10 '18 at 02:20
1

From http://jira.cubrid.org/browse/APIS-545. It it for a different driver, but it's the same error, so it might be the same solution

It is necessary to create a separate .ini file for CUBRID PDO driver like /etc/php5/cli/conf.d/pdo_cubrid.ini [...]

from your php.ini I see you have a pdo_odbc.ini:

/etc/php.d/pdo_odbc.ini, // which is not the same place

if you copy that pdo_odbc.ini file to your specific php version conf files (could be something like /etc/php5/conf.d), it might rule out the problem. From this: undefined symbol: pdo_parse_params in Unknown on line 0 I get the impression it does not properly load a script, not showing a name or even a valid line number

  • Could you elaborate on what "specific php version conf" files are, and where I'd find them? – Nathan Jones Jan 17 '14 at 17:04
  • Would it help if I posted the strace output when I run `php`? That might tell you where it's not finding the file/script you're referring to. – Nathan Jones Jan 17 '14 at 17:10
  • hmmm, I would like to see the content of pdo_odbc.so, and the current pdo_odbc.ini, located at `/etc/php.d/pdo_odbc.ini`. running `ee pdo_odbc.so` will likely open it in a readable format. Somewhere there should be a call to pdo_odbc.ini. that call might be to a bad path – Félix Adriyel Gagnon-Grenier Jan 17 '14 at 18:26
  • I'm having trouble finding `ee`. – Nathan Jones Jan 17 '14 at 18:47
  • 1
    *sorry, ee is for other environment, reading on fedora you have to use `emacs pdo_odbc.ini`. oh... but in fact it might not be installed, I though it came by default with fedora installs, but I can't verify that. don't bother, just the .ini file would do. – Félix Adriyel Gagnon-Grenier Jan 17 '14 at 18:49
  • I was referring to printing pdo_odbc.so in a readable format. Also, please see the edit I just made to the question for some more details. – Nathan Jones Jan 17 '14 at 18:50
  • I'm willing to install packages/compile software if need be. I just couldn't find anything on the fedora repos or source packages through google for it. – Nathan Jones Jan 17 '14 at 18:56
  • Is this an issue that should be submitted as a bug? If so, to whom? The PHP developers, Fedora developers, someone else? – Nathan Jones Jan 18 '14 at 05:10
  • There's several potential suspects, if I were to choose it would be more the pdo_odbc module developpers.. but I would think it's more a matter of wrong paths, then a bug in the code. I still couldn't get to my unix box to try and replicate this problem. Might take some days, I hope you don't need that too soon. – Félix Adriyel Gagnon-Grenier Jan 18 '14 at 21:20
  • Nope, it's not life or death that this works right this instant. I just need it to eventually work. The odd thing with wrong paths being a possible answer is that re-installing all of the php packages I listed in my original question didn't fix the problem or prompt me for the locations of anything. – Nathan Jones Jan 20 '14 at 01:07
  • And according to [this](http://pecl.php.net/package/PDO_ODBC), it looks like the pdo_odbc developer hasn't been active since 2006. – Nathan Jones Jan 20 '14 at 01:10