mssql_connect not defined on MS Windows w/ IIS

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • printline
    New Member
    • Jul 2006
    • 89

    mssql_connect not defined on MS Windows w/ IIS

    Hello

    I have problems connecting to my MSSQL through php.

    I have a microsoft windows server 2003, web edition with php5 installed and Microsoft SQL Server: SQL Server 2005 Express Edition as my platform.

    my connection string is as follows:

    [CODE=php]
    <?php
    $conn = mssql_connect(' 212.97.133.11', 'baconso_flemmi ng','mypassword ');
    mssql_select_db ('Baconso_flemm ing',$conn);
    ?>
    [/CODE]

    I get the following error message:

    Fatal error: Call to undefined function mssql_connect() in C:\Inetpub\wwwr oot\connopenphp .inc on line 2

    I have done all the usual things that has to be done in order to get mssql to work with php such as removing the ';' from the extension=php_m ssql.dll in my php.ini file.

    I have downloaded the proper version of ntwdblib.dll (vers. 2000.80.194.0) and copied certain files to windows/system32 directory such as the ntwdblib.dll file and the php_mssql.dll file.

    When i run a little file i made called info.php
    [CODE=php]<?php

    phpinfo();

    ?>
    [/CODE]

    I can't see any information about mssql in the description that appears on the screen.

    I also did another little file:

    [CODE=php]<?php
    if (function_exist s('mssql_query' )) {
    echo "MSSQL functions are available.<br />\n";
    } else {
    echo "MSSQL functions are not available.<br />\n";
    }
    ?>[/CODE]

    it returned: MSSQL functions are not available.

    Can anyone help me get my connection to work???????

    Any ideas are more than welcome........ .
    Last edited by pbmods; May 25 '07, 06:54 AM. Reason: Changed code language. Thanks for using CODE tags!
  • tolkienarda
    Contributor
    • Dec 2006
    • 316

    #2
    what php install are you using WAMP, some IIS install or is it on an apache web server

    here is what i always use

    [CODE=php]
    <?php
    $host="localhos t"; // Host name.
    $db_user="user" ; // MySQL username.
    $db_password="p ass"; // MySQL password.
    $database="dbna me"; // Database name.
    $ambi = mysql_pconnect( $host, $db_user, $db_password) or trigger_error(m ysql_error(),E_ USER_ERROR);
    ?>
    [/CODE]

    and i always use that then on the page i call that from i use the

    [CODE=php]
    <?
    include 'connect.php';
    mysql_select_db ($database, $ambi);
    ?>
    [/CODE]

    eric
    Last edited by pbmods; May 25 '07, 06:55 AM. Reason: Changed code language. Thanks for using CODE tags!

    Comment

    • printline
      New Member
      • Jul 2006
      • 89

      #3
      I do not use apache server. I use the built in IIS version 6. In php i selected IIS ISAPI module when installing.

      I tried your code suggestion, but it was the same.

      Comment

      • Motoma
        Recognized Expert Specialist
        • Jan 2007
        • 3236

        #4
        Did you try starting the IIS service after making the changed to php.ini?

        Have you gotten any error messages from IIS?

        Is php loading the proper .ini file?

        Comment

        • printline
          New Member
          • Jul 2006
          • 89

          #5
          I have tried restarting the IIS service after making changes to the php file.

          I haven't gotten any error messages from the IIS,only the error message before mentioned.

          I am loding the file php.ini

          Comment

          • Motoma
            Recognized Expert Specialist
            • Jan 2007
            • 3236

            #6
            What I meant was this: modify a value in php.ini that is coming up correctly in phpinfo() and check to see if that change was reflected in phpinfo(). If not, you may have your path incorrectly set.

            Comment

            • Motoma
              Recognized Expert Specialist
              • Jan 2007
              • 3236

              #7
              Originally posted by tolkienarda
              what php install are you using WAMP, some IIS install or is it on an apache web server

              here is what i always use

              Code:
              <?php
              $host="localhost"; // Host name.
              $db_user="user"; // MySQL username.
              $db_password="pass"; // MySQL password.
              $database="dbname"; // Database name.
              $ambi = mysql_pconnect($host, $db_user, $db_password) or trigger_error(mysql_error(),E_USER_ERROR);
              ?>
              and i always use that then on the page i call that from i use the

              Code:
              <?
               include 'connect.php';
               mysql_select_db($database, $ambi);
               ?>
              eric
              This will not help because the OP is trying to use MSSQL instead of MySQL.

              Comment

              • printline
                New Member
                • Jul 2006
                • 89

                #8
                I have to .ini files. One named php.ini-dist and an other named php.ini-recommended.

                Tried changing something in both of them, but the change didn't appear in the info.php file. Strange!

                Any idea why this occurs......... .............?

                Comment

                • Motoma
                  Recognized Expert Specialist
                  • Jan 2007
                  • 3236

                  #9
                  Originally posted by printline
                  I have to .ini files. One named php.ini-dist and an other named php.ini-recommended.

                  Tried changing something in both of them, but the change didn't appear in the info.php file. Strange!

                  Any idea why this occurs......... .............?
                  Because you are not changing php.ini which happens to be the file PHP is looking for.
                  You need to read through the PHP installation instructions to find out how to set up the config file and the system paths.

                  Comment

                  • pbmods
                    Recognized Expert Expert
                    • Apr 2007
                    • 5821

                    #10
                    Changed thread title to better match thread contents.

                    Comment

                    • printline
                      New Member
                      • Jul 2006
                      • 89

                      #11
                      that did it........

                      Thanks a lot.......

                      Comment

                      • Motoma
                        Recognized Expert Specialist
                        • Jan 2007
                        • 3236

                        #12
                        Originally posted by printline
                        that did it........

                        Thanks a lot.......
                        Awesome. Glad to help out.

                        Comment

                        • osmosis
                          New Member
                          • Jul 2007
                          • 1

                          #13
                          Hope someone can give me a bit of advice here. We had a wonderfully working implemention of php / mssql / windows 2003. Following patch Tuesday the php scripts can no longer talk to the database. Much googling has not gleaned a result, apart from taking away the I am alone with this problem feeling. Apparently removing service pack 2 will fix the problem. Any better suggestions ?

                          Comment

                          • Purple
                            Recognized Expert Contributor
                            • May 2007
                            • 404

                            #14
                            Hi osmosis and welcome to TSDN !

                            for info you should post this in a new thread..

                            I am running a number of server 2003 with sp2 installed and php 5, mssql with IIS 6 - have not experienced any issues with the service pack

                            I suggest you open a new thread and we can discuss further.

                            Regards Purple

                            Comment

                            Working...