Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP Module with incorrect compiled API (unable to initialize)

Tags:

php

sql-server

I'm trying to install freetds and php-mssql on a RHEL5 box. I've successfully done (what appears to be) everything. However, I get the following error when PHP attempts to load the module:

PHP Warning:  PHP Startup: mssql: Unable to initialize module
Module compiled with module API=20090626, debug=0, thread-safety=0
PHP    compiled with module API=20050922, debug=0, thread-safety=0
These options need to match

I've been pulling my brain out trying to figure out why they are different values, but having no success.

In the latest attempt, I downloaded the php source for the version I am running (php-5.3.8), went into the ext/mssql folder and ran phpize, configure, make, make install.

I verified the mssql.so file is in the appropriate folder, and that php is trying to load it.

phpize -v
Configuring for:
PHP Api Version:         20050922
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
like image 289
Andrew Vogel Avatar asked Dec 06 '11 20:12

Andrew Vogel


2 Answers

RHEL had an older version of php (5.1.x), and the installation of newer php versions (such as 5.3.x) means several changes. If you install from unofficial repos, you will see packages named php-* and php5-* . Having both versions can be the origin of the problems.

It looks like your system is accessing some configuration files from previous php installations.

Have a look at: - /etc/php.d Be sure you do not have elements from old versions - Have a look at /usr/bin/php-config* , If you have both php-config and php-config5, remove (rename) of /usr/bin/php-config and make a symlink to the new one:

# mv /usr/bin/php-config /usr/bin/php-config_old
# ln -s /usr/bin/php-config5 /usr/bin/php-config

Hope this helps

like image 194
jap1968 Avatar answered Nov 18 '22 11:11

jap1968


I can confirm that when a module doesn't load because of a different API it's because of an old php-config. Then you must look in /usr/bin/php-config and overwrite it with a newer version.

like image 42
Micromega Avatar answered Nov 18 '22 12:11

Micromega