Re: [PHP-DB] Getting PHP for Windows to talk to MS SQL?

2004-07-25 Thread Lester Caine
[EMAIL PROTECTED] wrote:
I discovered that PHP was not looking at C:\php\php.ini. Rather, somehow
it was looking at C:\Windows\php.ini. Anyway, now all is well. 
Yep - that is the right place on windows.
--
Lester Caine
-
L.S.Caine Electronic Services
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Getting PHP for Windows to talk to MS SQL?

2004-07-24 Thread weston
On Fri, Jul 23, 2004 at 01:56:08PM -0700, Marcjon wrote:
 php_mssql.dll doesn't go in your windows\system dir. It goes in the
 extensions dir. I believe the default in #PHPINSTALLDIR#\etx, though I
 may be wrong. Look in your PHP.ini file for the extensions directory
 setting and place the php_mssql.dll there.

Thanks for your help everyone! After getting the placement of php_mssql.dll
right and puzzling over the fact that I had in fact edited php.ini correctly...
I discovered that PHP was not looking at C:\php\php.ini. Rather, somehow
it was looking at C:\Windows\php.ini. Anyway, now all is well. 

Thanks again!

-Weston

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Getting PHP for Windows to talk to MS SQL?

2004-07-23 Thread Chris
[EMAIL PROTECTED] wrote:
I'm trying to get PHP (for Windows) to talk to MS SQL Server. This
is proving to be non-trivial. 

I downloaded and installed the Windows binary package on my machine 
(the machine is running Microsfot Windows XP Professional), and 
jumped through the hoops to get it running under Apache 2.0. So
far, so good.

Now, the first thing I noted was that the mssql functions actually
don't seem to exist in the binary... and apparently you have to
compile them in to PHP, after having built FreeTDS. This seems a bit
odd, as it's not at all clear to me that FreeTDS actually will
build under Windows at all (it being a UNIX solution). I did try
building it under cygwin, which ended with a flurry of error messages
in bsqldb.c, so this assumption seems correct. 

I did also note there are some DLLs one is supposed to install...
php_mssql.dll and ntwdblib.dll. I added both to Windows\System32, and
uncommented the php_mssql.dll line in php.ini, but
this didn't seem to change anything. This script:
if(function_exists('mssql_connect'))
echo \nMSSQL functions present;
else
echo \nMSSQL functions apparently missing;
gives the second result.
All right, approach #2... maybe I can use COM objects to try to 
connect to an ODBC data source, something like an example I found
on the php documentation for mssql:

$db = new COM(ADODB.Connection);
$dsn = DRIVER=SQL Server; SERVER=my.local.server;UID=user;PWD=passwd; 
DATABASE=dbname;
$db-Open($dsn);
$rs = $db-Execute(SELECT * FROM project LIMIT 1);
while (!$rs-EOF)
{
echo $rs-Fields['project_id']-Value.BR;
$rs-MoveNext();
}
This seems to at least kick up no errors up to a point... but
that point is when I try to wind through that loop, and I don't
really know COM objects well enough to troubleshoot this.
Any ideas what the right best way to do this is? I'd prefer to
use the mssql functions if I can... 

Thanks,
	Weston
 

To get the mssql_* functions to work you should be able to just include 
the extension with php.ini

Just look for ;extension=php_mssql.dll , and uncomment it. Be sure to 
restart Apache afterwards.

I haven't actually tried using mssql with PHP, but I *think* the 
computer may need some libraries installed before the functions will 
actually work properly.

Chris
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] Getting PHP for Windows to talk to MS SQL?

2004-07-23 Thread Gilmore, Corey (DPC)
 

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
 Sent: Friday, July 23, 2004 4:07 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Getting PHP for Windows to talk to MS SQL?
 
 I'm trying to get PHP (for Windows) to talk to MS SQL Server. 
 This is proving to be non-trivial. 
 
 I downloaded and installed the Windows binary package on my 
 machine (the machine is running Microsfot Windows XP 
 Professional), and jumped through the hoops to get it running 
 under Apache 2.0. So far, so good.
 
 Now, the first thing I noted was that the mssql functions 
 actually don't seem to exist in the binary... and apparently 
 you have to compile them in to PHP, after having built 
 FreeTDS. This seems a bit odd, as it's not at all clear to me 
 that FreeTDS actually will build under Windows at all (it 
 being a UNIX solution). I did try building it under cygwin, 
 which ended with a flurry of error messages in bsqldb.c, so 
 this assumption seems correct. 

They are not compiled into the binary, but are available as an extension
that you enable via php.ini

snip

 Any ideas what the right best way to do this is? I'd prefer 
 to use the mssql functions if I can... 
 

I'm doing the same thing on my workstation with Apache 2, PHP 5 and
MSSQL 2000.  
* ntwdblib.dll is in %systemroot%\system32\.  
* I am not using the bundled ntwdblib.dll
* PHP is installed in c:\php from binary zip, pecl extensions are in
c:\php\ext
* (php.ini) extension_dir = c:\php\ext\
* (php.ini) extension=php_mssql.dll is uncommented
* php_mssql.dll is in c:\php\ext, not %systemroot%\system32\
* SQL Server 2000 is installed

The md5sum of my ntwdblib.dll is 4a76e50c4921ca9a35c5bb3c010b0cf8
I tested with the bundled ntwdblib.dll, which worked as well.

Try moving php_mssql.dll back into your extension directory, ensure that
the 'extension_dir' value is correct, restart apache and test again.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php