php-mssql on centos5

Issues related to software problems.
giorgioqa
Posts: 1
Joined: 2007/05/04 13:55:50

php-mssql on centos5

Post by giorgioqa » 2007/05/04 14:14:17

Hi all, i'm relatively new to the world of CentOS.

I was looking for php-mssql to allow authentication against a m$ sql server with freetds but seems like no support is provided.
I found at [url=http://phprpms.sourceforge.net/mssql]phprpms[/url] an rpm for fc4 (php-mssql-5.0.4-10.1.i386.rpm) but even adding extension=mssql.so into php.ini the support won't show within phpinfo.

from /var/log/error_log:

[quote]Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/mssql.so' - /usr/lib/php/modules/mssql.so: undefined symbol: empty_string in Unknown on line 0
[/quote]

as i can see again into phpinfo, seems like dist php hasn't support built in, or should it ever require that?

[quote]'./configure' '--build=i686-redhat-linux-gnu' '--host=i686-redhat-linux-gnu' '--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-libdir=lib' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic' '--disable-rpath' '--without-pear' '--with-bz2' '--with-curl' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png' '--with-pspell' '--with-expat-dir=/usr' '--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--with-kerberos' '--enable-ucd-snmp-hack' '--with-unixODBC=shared,/usr' '--enable-memory-limit' '--enable-shmop' '--enable-calendar' '--enable-dbx' '--enable-dio' '--with-mime-magic=/etc/httpd/conf/magic' '--without-sqlite' '--with-libxml-dir=/usr' '--with-xml' '--with-apxs2=/usr/sbin/apxs' '--without-mysql' '--without-gd' '--without-odbc' '--disable-dom' '--disable-dba' '--without-unixODBC' '--disable-pdo' '--disable-xmlreader' '--disable-xmlwriter' [/quote]

the centos4.4 i was running before trying this release was working flawlessly but I had to compile myself the whole php stuff. do i have to compile again on centos5 to allow mssql?
thank you!

g.

domeger
Posts: 5
Joined: 2007/06/05 04:32:10
Contact:

Re: php-mssql on centos5

Post by domeger » 2007/06/05 04:34:01

I am having the same problem, i am unable to get the freetds working on the x64 version of CentOS 5, and also 4.4 for some odd reason, i have tried source, rpm, and depos with suggested solutions that may work. None have so far. Anyone else have this problem ?

thim
Posts: 12
Joined: 2005/09/19 10:14:46

php-mssql on centos5

Post by thim » 2007/06/05 06:45:00

Have the same problem,

I'm going to try this
http://karlkatzke.com/centos-44-ms-sql-freetds-and-php/

It's an how to for 'Centos 4.4 and MSSQL' but I hope that the same manner applies for Centos 5.

If someone knows another method or have an RPM pr?-built let us know.

thim
Posts: 12
Joined: 2005/09/19 10:14:46

Re: php-mssql on centos5

Post by thim » 2007/06/05 10:00:16

I did it.

It's indeed fairly simple, here's my procedure.
You need to activate the RPMForge custom repository (formely known as Dag Wieers)

http://dag.wieers.com/rpm/packages/rpmforge-release/
Grab your specific RPM and install it.

# yum groupinstall ?Development Tools?
# yum install freetds freetds-devel --enablerepo=rpmforge
# yum install php-devel

# vi /usr/src/redhat/SPECS/php.spec

edit the CFLAGS= line (~line 310) of the php.spec file - remove ? -Wno-pointer-sign?

add the following piece of code to it.


%package mssql
Group: Development/Languages
Requires: php = %{version}-%{release}, php-pdo
Summary: A module for PHP applications that use the MSSQL database.
provides: php_database
BuildRequires: freetds-devel

%description mssql
The MSSQL package contains a dynamic shared object that will add
support for accessing MSSQL databases to php.


# rpmbuild -bb ./php.spec

If has is asking for some dependancies just yum install them

# cd /usr/src/redhat/BUILD/php-5.1.6/ext/mssql/

Now we are going to make the mssql module without having to rewrite the php binairy.
# phpize
# ./configure --with-mssql
# make
# make install

Next look for the mssql.so and make sure it is in the module directory specified in your php.ini.

final step
# vi /etc/php.ini
add this line to php.ini

extension=mssql.so

save php.ini and restart apache
# /etc/init.d/httpd restart

?h voila you have just made your mssql module without having to chang anything to the Centos 5 HTTPD / PHP setup.

gdekbca
Posts: 3
Joined: 2007/06/13 12:26:12

Re: php-mssql on centos5

Post by gdekbca » 2007/06/13 12:30:10

I have tried to do this, but in my CentOS 5 installation there aren't this file: /usr/src/redhat/SPECS/php.spec and this command line show this error message: "Cannot find config.m4.
Make sure that you run '/usr/bin/phpize' in the top level source directory of the module"

can you help me!?!

sorry my bad English!!

Diego

foxb
Posts: 1927
Joined: 2006/04/20 19:03:33
Location: Montreal/QC

Re: php-mssql on centos5

Post by foxb » 2007/06/13 14:33:45

http://www.howtoforge.com/installing_php_mssql_centos5.0

RemiFedora
Posts: 19
Joined: 2007/05/10 17:13:40
Location: Champagne...
Contact:

Re: php-mssql on centos5

Post by RemiFedora » 2007/06/13 15:57:34

Have a look at : http://remi.collet.free.fr/rpms/el5.i386/

Well, it's php-5.2.3, but will most extensions provided (mssql, oci8, ...)

All is there.
Remi.

gdekbca
Posts: 3
Joined: 2007/06/13 12:26:12

Re: php-mssql on centos5

Post by gdekbca » 2007/06/14 13:04:54

I understood, but I can't do it yet.
My problem now is:
in the directory "/usr/src/redhat/BUILD" doesn't have the php source.
I already tried
# yum groupinstall ?Development Tools?
# yum install freetds freetds-devel --enablerepo=rpmforge
# yum install php-devel

but doesn't works.

my real problem is that I have to connect php [color=CC3300]on[/color] sybase [color=0000FF](or in sybase? sorry again)[/color] with CentOS 5.
So, I need "to recompile" the php with support to sybase. Is very difficult to find any information about that, because this I am trying now in English. :p
thanks a lot to everyone.

Diego

ps: Sorry again for my bad English, but I'm learning yet.

gdekbca
Posts: 3
Joined: 2007/06/13 12:26:12

Re: php-mssql on centos5

Post by gdekbca » 2007/06/22 20:21:56

I did it!!!
thx everybody

below the solution
by me (but in Portuguese, kkk)

/************************************************************/
Instru??es que permite conectar o PHP a servidores Linux ou Windows rodando Sybase ou SQL Server

Copie os seguintes arquivos do servidor:
freetds-stable.tgz
php-5.2.3.tar.gz
httpd-2.2.4.tar.gz
SybSQL-1.0-0.i386.rpm
Extrair na seguinte estrutura
/home/web/freetds
/home/web/php
/home/web/apache
o SybSQL deve ser somente instalado.

obs.: Foi instalado em CentOS 5 sem php ou apache instalados.

INSTALANDO FREETDS

1- Entre na pasta de instala??o do FreeTDS #cd /home/web/freetds
3- #./configure --prefix=/opt/web/freetds --with-tdsver=8.0 --enable-msdblib --enable-dbmfix --with-gnu-ld

Nota: tdsver=8.0 se voc? usa SQL 2000, tdsver=7.0 se voc? usa SQL 7.0

4-# make
5-# make install
6-# /opt/web/freetds/bin/tsql -S -U

7- Adicione a seguinte linha no arquivo /etc/ld.so.conf
/usr/local/freetds/lib

INSTALANDO APACHE

1- Entre na pasta de instala??o do Apache #cd /home/web/apache
2- #./configure --prefix=/opt/web/apache --enable-so
3- make
4- make install
5- Teste o apache:
# /opt/web/apache/bin/apachectl start
# /opt/web/apache/bin/apachectl stop

INSTALANDO PHP

1- Entre na pasta de instala??o do PHP #cd /home/web/php
2- ./configure --with-apxs2=/opt/web/apache/bin/apxs --enable-versioning --with-mssql=/opt/web/freetds
3- make
4- make install
5- cp /home/php.ini-DIST /usr/local/lib/php.ini
6- Adicione a seguinte linha no arquivo /opt/web/apache/conf/httpd.conf
AddType application/x-httpd-php .php

TESTANDO

com o apache iniciado e com uma tabela de teste j? criada no Banco de dados, crie o seguinte arquivo
#vim teste.php

com o conteúdo:
", "sa", "");
mssql_select_db ("", $con);
$sql= "SELECT * FROM ";
$rs= mssql_query ($sql, $con);
echo "O campo número um ?: ";
echo mssql_result ($rs, 0, 0);
mssql_close ($con);
?>

Se aparecer o conteudo da tabela do banco de dados est? tudo OK

ruben-ortiz
Posts: 3
Joined: 2007/09/13 09:09:46
Contact:

Re: php-mssql on centos5

Post by ruben-ortiz » 2007/11/23 15:36:15

Hello

i applied the howto of thim but i can't connect to SQL Server(2005 or 2000). I tested the connection with this script:

[code]
$hostdbnot = "xxx";
$userdbnot = "xxx";
$passdbnot = "xxx";
$basedbnot = "xxx";

$dbgamesnot = mssql_connect($hostdbnot, $userdbnot, $passdbnot);
if ($dbgamesnot) echo 'Great!';
else echo 'Damn';
mssql_select_db($basedbnot, $dbgamesnot);

echo mssql_get_last_message();
[/code]

The code returns "Damn" string. I have a php scritp with phpinfo() and this function returns as MSSQL is enabled. Are there any other action to try or test?

Thanks

Post Reply

Return to “CentOS 5 - Software Support”