PHP Doku:: Installation - mssql.installation.html

Verlauf / Chronik / History: (1) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzDatenbankerweiterungenAnbieterspezifische DatenbankerweiterungenMicrosoft SQL ServerInstallation/KonfigurationInstallation

Ein Service von Reinhard Neidl - Webprogrammierung.

Installation/Konfiguration

<<Anforderungen

Laufzeit-Konfiguration>>

Installation

Die MSSQL-Erweiterung wird durch den Eintrag extension=php_mssql.dll in die php.ini aktiviert.

Damit diese Funktionen zur Verfügung stehen, müssen Sie PHP mit --with-mssql[=DIR] kompilieren, wobei DIR der Präfix der FreeTDS-Installation ist. Und FreeTDS muss mit --enable-msdblib kompiliert werden.

Warnung

Falls PHP mit der Sybase-Erweiterung und ohne die MS SQL-Erweiterung kompiliert wurde, sind MS SQL-Funktionen Alias für Sybase-Funktionen.


4 BenutzerBeiträge:
- Beiträge aktualisieren...
Dave
25.01.2010 22:25
Linux users: I had to set the TDSDUMP and TDSCONFDUMP environment variables in my apache init script in order for freetds/mssql connections to work:

In my /etc/init.d/httpd file:
export FREETDSCONF=/usr/local/freetds/etc/freetds.conf
export SYBASE=/usr/local/freetds
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$SYBASE/lib
export TDSDUMP=/var/log/freetds/tdsdump-apache_log
export TDSDUMPCONF=/var/log/freetds/tdsdumpconf-apache_log

Make sure apache can write to the TDSDUMP directory.

(Using FreeTDS 0.82, PHP 5.2.9)
mirko dot steiner at slashdevslashnull dot de
29.09.2009 12:36
PHP msdblib niggle encountered

In configuring your new version of PHP to work with FreeTDS 0.82, you may encounter:
configure: error: Directory /usr/local/freetds-0.82 is not a FreeTDS installation directory
PHP tests for a FreeTDS installation by looking for files that FreeTDS no longer installs. To assure PHP that FreeTDS is installed, create two files where FreeTDS was installed e.g.:
$ touch /usr/local/freetds-0.82/include/tds.h
$ touch /usr/local/freetds-0.82/lib/libtds.a
The file that needs to be changed is used by autoconf when the distribution tarball is constructed. Cf. revision 1.13 of PHP source file config.m4. (12 June 2008)

(http://www.freetds.org/news.html)
jonatasvenancio at gmail dot com
3.03.2009 20:07
Finally i did it.

I could make the connection with MS-SQL:
1 - I downloaded the new version of ntwdblib.dll like we already saw at the others posts.
2 - I actived the php_mssql.dll in php.ini (the DLL must be in your extension dir)
3 - Restarted apache.
4 - Got my MS-SQL name instance (in my case was SQLEXPRESS because i was using MS-SQL Express Version and didn't change the default configuration).
5 - I did my connection file.

#################
<?php
$conn
= mssql_connect("ADMIN-PC\SQLEXPRESS", "usuario", "senha") or die ("erro ao conectar");

// Admin-PC is the name of my computer and SQLExpress is the name of MS-SQL Instance).
// usuario is a user that i created on SQL server with this command.
// SP_AddLogin 'user', 'password'
// after that i used this onde SP_AddUser 'user'
// you can change fot the user you want.
// I cound't use the defaullt user of MS-SQL, but with this one the connection worked.

?>

I hope this can help you.

Sorry for the english.
I'm brasilian.
Venâncio
Matt Mason
9.07.2008 19:42
Had a problem compiling PHP with --with-mssql=/usr/local/freetds , kept saying that it wasn't a valid FreeTDS directory...

Check that when you install FreeTDS from source, that it actually puts the required files from the source directory to where the installation directory was specified, so to fix:

cp [tds source]/include/tds.h /usr/local/freetds/include
cp [tds source]src/tds/.libs/libtds.a /usr/local/freetds/lib

{in this example I installed FreeTDS to /usr/local/freetds}

This may make it a little easier for some else too.



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)