Rpms with it pre-built, should have thought of that... http://phprpms.sourceforge.net/mssql
Also, Anna is correct in mentioning you'll want to use mssql_ functions and not the odbc_ functions. While ODBC should work in theory I've never actually seen it work between php and mssql. Kyle On Fri, 7 Jul 2006 01:21:04 -0700, Anna <[EMAIL PROTECTED]> wrote: > You gave a lot of good info, though without a look at your actual > phpinfo() output it's hard to tell. > > But, one weird thing is it seems you're attempting to use the odbc_* > functions? I think what you would want to use are the mssql_* > functions. have you read this?: > > http://us3.php.net/mssql > > > the php.net manual is a very good reference. it's the first place I > look whenever I have a question. so... do you get an error when you try > to use a function like: > > <? > $res = mssql_connect ( 'myserver', 'usrme', 'doublesecret' ); > ?> > > I'm guessing you get an error telling you the function mssql_connect > isn't defined. like this: > > "Fatal error: Call to undefined function: mssql_connect() in > /var/www/virthosts/internaltesting.net/phpinfo.php on line 5" > > If so, that means you do not have the mssql stuff available to your php > apache module (it's not built in and there is no separate module > present). It's been a while since I've messed with building any php > software because I use mysql and everything just works. It's sort of > hard to believe but, I think you may need to build a php module from > scratch. Nothing pre-built-with-mssql comes with Debian. who knows > why? If that's true of Debian, it's probably true of Fedora as well. > You might have luck at searching for an rpm. > > - Anna > > > > On Thu, Jul 06, 2006 at 04:09:33PM -0700, Horalia Rodriguez wrote: >> Hi Anna, thank you for responsing so soon. Here are the details of my >> latest attempts in getting this to work: >> >> 1. I reloaded Fedora Core 5 as a web server on the PC. >> 2. I installed freetds by following these steps: >> # rpm --import http://dries.studentenweb.org/rpm/RPM-GPG-KEY.dries.txt >> -Created a file in /etc/yum.repos.d/dries.repo with the following > contents: >> [dries] >> name=Extra Fedora rpms dries - $releasever - $basearch >> > baseurl=http://ftp.belnet.be/packages/dries.ulyssis.org/fedora/linux/$releasever/$basearch/dries/RPMS/ >> enabled=1 >> gpgcheck=1 >> -I then issued the following command: >> # yum install freetds >> -After this, I tested freetds using tsql. A prompt 1> came up. >> 3. After installing freetds, I created the DSN to connect to the MSSQL >> server. Here's how I did this: >> -Created a file under root named tds.driver.template with the following >> lines: >> [FreeTDS] >> Description = v0.63 with protocol v8.0 >> Driver = /usr/lib/libtdsodbc.so.0 >> -Executed the following command, which registers the ODBC driver: >> #odbcinst -i -d -f tds.driver.template >> -Created a second file also under root named tds.datasource.template > with >> the following lines: >> [MSSQLTestServer] >> Driver = FreeTDS >> Description = <DB Description> >> Trace = No >> Server = <MSSQL ip address> >> Port = 1433 >> Database = <DB name> >> -Executed the following command: >> # odbcinst -i -s -f tds.datasource.template -l >> -Tested the connection: >> (Copied directly from terminal window) >> [EMAIL PROTECTED] /]# isql MSSQLTestServer rsm rsm >> +---------------------------------------+ >> | Connected! | >> | | >> | sql-statement | >> | help [tablename] | >> | quit | >> | | >> +---------------------------------------+ >> SQL> >> -I was able to successfully run a query at this point. >> 4. I then followed these steps that were given to me by another person > that >> is trying to help me: >> # wget >> > http://remi.collet.free.fr/rpms/fc5.i386/remi-release-1-1.fc5.remi.noarch.rpm >> # rpm -Uvh remi-release-1-1.fc5.remi.noarch.rpm >> # yum --enablerepo=remi install php-mssql php >> 5. At this point, I restarted the http service, tried to connect to the >> MSSQL server which I did. >> 6. I created a phpinfo page, which came up successfully. I then checked > the >> configuration, and mssql is not included. I did however find this line: >> /etc/php.d/ldap.ini, /etc/php.d/mssql.ini >> under the additional .ini files parsed section. >> 7. Hoping that this was going to work, I attempted to load the following >> php page, but only a blank page came up: >> <?php >> $connect = odbc_connect("MSSQLTestServer","user","pwd"); >> if (!$connect) die ("Invalid connection"); >> ?> >> I purposly used a bogus username but the error message did not come up. > I >> then tried to use this code: >> <?php >> connect = mssql_connect("10.7.122.28,1433","user","pwd"); >> if (!$connect) die ("Invalid connection");*/ >> ?> >> >> I also added the following lines to freetds.conf: >> >> [TDS] >> host = <ip address of the server with sql> >> port = 1433 >> tds version = 8.0 >> >> I have done these steps so many times, that I already know them by > heart. I >> have also reloaded Fedora many times, so if you need me to start fresh, > I >> will do so. Any help will be appreciated, my supervisor has been very >> patient with me, but I know that its only a matter of time before he > starts >> asking for results. The first time I installed Fedora Core was on June > 6th, >> so you can see that I've struggling with this for quite some time now. >> >> Thanks! >> >> >> >> From: Anna <[EMAIL PROTECTED]> >> To: [email protected] >> CC: Horalia Rodriguez <[EMAIL PROTECTED]> >> Subject: Re: [RLUG] Help with Linux >> Date: Thu, 6 Jul 2006 15:37:32 -0700 >> >> Hi Horalia. >> >> Have you run the phpinfo() function to see what you have installed and >> how it's configured? if not, make a php file containing only this line: >> >> <? phpinfo(); ?> >> >> then study the result in a web browser. if you need help deciphering > it, >> post (pieces of the) the result here... or post a url to your phpinfo() >> page so we can take a look. >> >> You want to start with debugging the basics. questions: is the php >> program you have even trying to connect to the server? is it giving any >> error messages on the page or in the logs? if the web server and db >> server on different machines can you see any db traffic at all moving >> between them with packet sniffer? are their any interesting logs on the >> db server? >> >> - Anna >> >> >> On Thu, Jul 06, 2006 at 03:24:37PM -0700, Horalia Rodriguez wrote: >> > >> > Hi, >> > >> > Sebastian Smith suggested that I send an e-mail here to see if I could >> get some >> > help to resolve my issue. I ll be very brief. >> > >> > I am trying to connect to a MSSQL server from a Fedora Core box > through >> php. I >> > have already successfully installed freetds, but I can t get php to > work. >> I >> > have installed freetds several different ways to no avail. I believe > that >> it is >> > installed correctly because I can connect to the MSSQL server from the >> terminal >> > window and run a query successfully. I have also tried installing php >> using ./ >> > configure with-mssql= freetds-path with no success. Could someone > send >> me >> > detailed instructions on how to do this? I m very new to Linux and > have >> been >> > struggling to get this working for the past month. I ve been dreaming >> about >> > rpms, unixODBC, php code, you name it. I have reloaded Fedora more > times >> that I >> > care to remember, so any suggestions will be appreciated. >> > >> > Thanks, >> > >> > >> > Horalia Rodriguez >> > [EMAIL PROTECTED] >> >> _________________________________________________________________ >> Don?t just search. Find. Check out the new MSN Search! >> http://search.msn.click-url.com/go/onm00200636ave/direct/01/ >> > > _______________________________________________ > RLUG mailing list > [email protected] > http://lists.rlug.org/mailman/listinfo/rlug _______________________________________________ RLUG mailing list [email protected] http://lists.rlug.org/mailman/listinfo/rlug
