Jump to content
#StayAtHome ×

Archived

This topic is now archived and is closed to further replies.

Treeko

[SOLVED] I am in a pickle jar.

Recommended Posts

Edit:

 

I am using an Apache HTTP server, version 2.0.

I have installed PHP version 5.2.8.

I am using Windows XP Professional, service pack 2.

I am using MS SQL Server Express Edition 2008.

 

end edit.

 

I've been reading through other threads on this forum, and I have the same issue as a lot of other people... just trying to get everything set up and working.

 

I'm trying to connect to an MS SQL Server Express Edition 2008 through PHP.

 

The part that I am stuck at right now...

 

When I do a phpinfo() call, I do not see an "mssql" module anywhere, I do, however, see an "sqlsrv" module listed.  As can be seen here: http://img.photobucket.com/albums/v228/Treeko/MS%20SQL%20Stuff/MSSQLHelp001.png

 

And also as can be seen here: http://img.photobucket.com/albums/v228/Treeko/MS%20SQL%20Stuff/MSSQLHelp002.png

 

==========

 

I have...

 

I have this little bit o' kode right here:

 

    <?php

 

$server = 'SECRET\SQLEXPRESS';

 

$link = mssql_connect($server, 'SECRET/Administrator', 'my administrator password');

 

if(!$link)

{

    die('Something went wrong while connecting to MSSQL');

}

 

    ?>

 

And I am sure that the line "$link = mssql_connect($server, 'SECRET/Administrator', 'PASSWORD');" is the problem c.c

 

When I try to run this page, I just get a blank page displayed, which is what happens when you make a typo on a php function or something.  So my guess is that the function "mssql_connect" is not being recognized, WHICH IS WHY I think that my uh... MS SQL support for PHP is not working properly.

 

I'm also very unsure as to what... accounts/password I'm supposed to use to try to connect to an MS SQL database.

 

Should I make a separate windows user account for connecting to MS SQL?

 

Is that user account supposed to be... logged onto windows?

 

Is it supposed to be an administrator account?

 

Am I supposed to set up a password for the windows account, then use that same password to try and connect to the SQL Server?

 

I just... don't know!

 

 

Also, whoever directly aids me in solving my problem gets a free hug, but only one.

 

Share this post


Link to post
Share on other sites

I added extension=php_mssql.dll into php.ini myself!

 

I added:

extension=php_sqlsrv_ts.dll

as well!  I'm using the tread safe version. :o

 

Not only did I uncomment extension=php_mssql.dll, I uncommented the crap out if it!

Share this post


Link to post
Share on other sites

Is there an error in Apache's error log?

 

 

(You are using Apache, yes?)

Share this post


Link to post
Share on other sites

O_O Apache error log!  I shall check it momentarily!

 

And yes, I'm using Apache HTTP server, version 2 point oh. (2.0)

 

c.c you should contact me on AIM or something, real-time communication would be awesomesauce.

 

...

 

Oh snap...

 

"PHP Warning:  PHP Startup: Unable to load dynamic library './php_mssql.dll' - The specified module could not be found.\r\n in Unknown on line 0"

 

Oh god oh god what to do, what to do? D:

Share this post


Link to post
Share on other sites

"PHP Warning:  PHP Startup: Unable to load dynamic library './php_mssql.dll' - The specified module could not be found.\r\n in Unknown on line 0"

 

 

 

Well, you could start with reading the error.  ;p.  It's pretty clear.

 

 

I would take away three conclusions from the error msg:

-The DLL isn't in the right place.

-PHP is looking in the wrong place.

-PHP (in this case Apache) does not have read access to the DLL.

 

 

In this case, I would go ahead and guess option 2.

 

Have you set extension_dir in php.ini?

Share this post


Link to post
Share on other sites

Yes I read it! D:

 

I left extension_dir in php.ini as the default... which I believe has it so the root directory, that is, the same directory that php.ini is in, will function as the extension directory?

 

I put php_mssql.dll both there, and in system32 just for the hell of it. c.c

 

extension_dir = "./"    is what I have right now.

 

Hm.  *doing stuff*

Share this post


Link to post
Share on other sites

Hrmmm not sure why it's not finding it then x.x.

 

 

./ might refer to the Apache directory by some weird chance.  I doubt it, but since PHP would be run under Apache, maybe.  I always just use an absolute path.  Try an absolute folder path.  Something like C:/path/to/ext/folder/

Share this post


Link to post
Share on other sites

Hm.

 

Well, the absolute path reference works...

 

but I'm getting the same results as before, the sqlsrv module appears, but the mssql module does not appear.

 

As a side note, did you look at the photobucket images in my first post? c.c

Share this post


Link to post
Share on other sites

(Sorry for assuming you hadn't thought about the error message earlier....  Had a moment >.<.)

 

 

 

Anyway, yeah I looked at the pic.  It worked, but it's still not in phpinfo()?  Does that mean that there's a different error message now?  I wonder if this is related to a dependency dll....  I remember there have problems before with a missing DLL that php_mssql needs.  I don't remember which one it is though x.x.

Share this post


Link to post
Share on other sites

Oh wait a minute...

 

PHP Warning:  PHP Startup: Unable to load dynamic library 'C:\\Program Files\\PHP\\Ext\\php_mssql.dll' - The specified module could not be found.\r\n in Unknown on line 0

 

 

fffffffffuuuuuuuuuuuu--

 

Are those double backslashes supposed to be there?  c.c I'm sure that is the right path.

Share this post


Link to post
Share on other sites

It shouldn't have double backslashes, but I doubt that is the problem.  Just to be safe though, you could use /, or some how get it to stop using \\.

 

 

 

Edit, just in case it's a DLL dependency issue, I checked what DLL's php_mssql imports.  It imports php5ts.dll, ntwdblib.dll, MSVCRT.dll, and KERNEL32.dll.

 

 

So you might want to make sure all of those are in your PATH (ntwdblib.dll is the most likely one to be missing).

 

 

I don't know if that's the problem or not.  I just remember having to find a DLL when I installed PHP ages ago.

Share this post


Link to post
Share on other sites

Well c.c, I'm trying various methods of slashes and backslashes, but to no avail!

 

...

 

The following is from php.ini:

 

; UNIX: "/path1:/path2"

;include_path = ".:/php/includes"

;

; Windows: "\path1;\path2"

;include_path = ".;c:\php\includes"

 

What purpose does the ".:" and the ".;" serve?

 

The following is also from php.ini:

 

;extension_dir = "./"

 

This is the commented out default value for extension_dir

"./" ?  A dot and a slash?  I don't think I know what that... does?

 

Enlighten me? D:

Share this post


Link to post
Share on other sites

It's just different formats of file paths.

 

 

Traditionally, : separates two paths on linux.  For example, the include path might be /some/path/folder1/:/some/other/path/, and that would mean to look in /some/path/folder1/ first, and if what is being searched for is not found in there, try the other path next and so on down the line.

 

; is the same thing except in Windows.

 

 

. means the current directory.  For example, if you open cmd and do "cd .", it won't take you any where.  The slash on the end is often added to know that it's a directory, or in some cases so it can be appended on to.

 

(If you took . and added SomeFolderName to it, instead of getting <current dir>/SomeFolderName, you would get .SomeFolderName.)

Share this post


Link to post
Share on other sites

So as it stands...

 

I am still in a pickle jar!  D:

 

Hm.

 

What was that you said about another DLL file that php_mssql.dll depended on? c.c

 

Or for that matter... any ideas on what might be going on here?

 

Oh and thanks for the lesson on file-paths :D

Share this post


Link to post
Share on other sites

Hrmmmm....  What php.ini does phpinfo say php is reading?

 

 

 

Also, if you're using MSSQL 05, you could use php_sqlsrv.dll.  If you ever wanted to downgrade to 00 that probably would have some issues though (00 is 9 years old though x.x).

 

 

Anyway, check if ntwdblib.dll is on your computer some where.

Share this post


Link to post
Share on other sites

See, I really don't know much about this stuff...

 

First off... the phpinfo() info.

 

Configuration File (php.ini) Path: C:\WINDOWS

Loaded Configuration File:      C:\Program Files\PHP\php.ini

 

O_o;

 

The path seems to be wrong, at C:\WINDOWS, yet... the file it actually loaded seems to be correct?  C:\Program Files\PHP\php.ini is correct.

 

As far as php_sqlsrv_ts.dll is concerned (the thread safe version is supposed to be used with Apache or something, hence the "_ts" on the end), I have gotten the php_sqlsrv_ts.dll module to appear correctly.

 

But even when that is loaded, my php statement that I included on my original post still caused a blank screen, which leads me to believe that the function call I was using wasn't being recognized by php and so forth.

 

From what I have read after googling around, php_sqlsrv_ts.dll can be used with MS SQL 2008...

Share this post


Link to post
Share on other sites

Were you using mssql_connect with sqlsrv?

 

 

http://blogs.msdn.com/sqlphp/

 

It would appear that it uses functions like sqlsrv_*.

 

 

I still can't figure out why php_mssql.dll won't work though x.x.

Share this post


Link to post
Share on other sites

Oh... wait, are you saying that I should be using sqlsrv_connect instead of mssql_connect?

 

c.c does this mean that... i... adsklajdkl *explodes*

Share this post


Link to post
Share on other sites

Yes you should be using that, if you want to use the sqlsrv extension.  If you want to use the php_mssql extension, you should use mssql_connect.

Share this post


Link to post
Share on other sites

So... c.c

 

Might I ask what the difference is between the two.  Y'know... other than the syntax? c.c

Share this post


Link to post
Share on other sites

The frustrating thing is that "php_sqlsrv_ts.dll" seems to have no trouble loading at all, every time, yet "php_mssql.dll" which is in the exact same folder as "php_sqlsrv_ts.dll" never loads properly.

 

I don't get it, I seriously don't get it... i will disperse my frustration by slitting my wrists and listening to emo music.  c.c

 

 

Share this post


Link to post
Share on other sites

Blerh this is weird....  I wonder if there is a small chance that php_mssql.dll is corrupted or something.

 

 

 

So the entire error message is what you said earlier?  That's so weird.  A missing dependency is the only thing I can think of at this point, but maybe something just hasn't occured to me yet x.x.

Share this post


Link to post
Share on other sites

Well... I have heard that ntwdblib.dll is a dependancy for php_mssql.dll, and I have that file... all over the place.  Copies residing both in c:\windows\system32, and in c:\php\ext.

 

I reinstalled my PHP to C:\PHP\, in case the error was that the original install path had a space in it, "C:\Program Files\PHP\".

 

As of right now, the only module that will load correctly is "php_sqlsrv_ts.dll".

 

I put in two other modules, "php_exif.dll" and "php_mbstring.dll", and neither of those will load correctly either.

 

I'm still getting:

 

PHP Warning:  PHP Startup: Unable to load dynamic library 'c:\\php\\ext\\php_mbstring.dll' - The specified module could not be found.\r\n in Unknown on line 0

PHP Warning:  PHP Startup: Unable to load dynamic library 'c:\\php\\ext\\php_exif.dll' - The specified module could not be found.\r\n in Unknown on line 0

PHP Warning:  PHP Startup: Unable to load dynamic library 'c:\\php\\ext\\php_mssql.dll' - The specified module could not be found.\r\n in Unknown on line 0

 

 

c.c  I still don't get why I'm getting the double slashes... something to do with escape characters, maybe?

Share this post


Link to post
Share on other sites

Hrmmm, try using backslashes instead.

 

 

 

C:/PHP/ext/ for example

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.