SitePoint Sponsor

User Tag List

Results 1 to 23 of 23
  1. #1
    SitePoint Wizard
    Join Date
    Apr 2004
    Location
    dublin
    Posts
    2,036
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    SQL Server 2005 Login

    Hi all,

    How do I set up user login for SQL Server 2005? I want my website to be able to connect to the database on SQL Server but am having problems.
    Do I add a user in the Security section?

    Thanks.

    My PHP code also not giving errors. But it dies when unable to connect...

    PHP Code:
    <?php
    // Connect to Database
    $db mssql_connect('localhost''central, 'central23');
    if (!$db)
    {
       echo '
    Could not connect';
      exit;
    }
    // Select Database
    mssql_select_db('
    mydatabase') or die('DB Connect Error');
    ?>

  2. #2
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,653
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Pretty much the same way you did in 2000. Check the books online (or integrated help) for a full tutorial.

  3. #3
    SitePoint Guru SSJ's Avatar
    Join Date
    Jan 2007
    Posts
    830
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes I think you have to add the user in Security section.
    Give it a try and let me know if it works...

  4. #4
    SitePoint Wizard
    Join Date
    Apr 2004
    Location
    dublin
    Posts
    2,036
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I created a new user but doesn't connect. However my PHP connection doesn't display any errors .
    Call the connection from here...
    include('../includes/db_connect.php');

    Any ideas?

    Thanks.

  5. #5
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,653
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Did you add the user to the database? Did you run through the surface area configuration?

    You are eating the error in that php script, I would remove the "or die()" bit of things and see what it spits back.

  6. #6
    SitePoint Wizard
    Join Date
    Apr 2004
    Location
    dublin
    Posts
    2,036
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    get this error now...
    Fatal error: Call to undefined function: mssql_connect() in C:\Inetpub\wwwroot\centralised\includes\db_connect.php on line 4

    here's Line 4...
    // Connect to Database
    $db = mssql_connect('local', 'central', 'central);

  7. #7
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,653
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Your problem appears to be with your php configuration--have you enabled the mssql extenion?

  8. #8
    SitePoint Wizard
    Join Date
    Apr 2004
    Location
    dublin
    Posts
    2,036
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes just enabled and restarted iis but no change. thought that was the problem??

  9. #9
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,653
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Is the extension actually working? I would consult the PHP manual, there are a few tricks in making it go.

  10. #10
    SitePoint Wizard
    Join Date
    Apr 2004
    Location
    dublin
    Posts
    2,036
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    doesnt seem to be. looked through php.net docs but no luck yet. any ideas? thanks.

  11. #11
    SitePoint Zealot dadofgage's Avatar
    Join Date
    Feb 2005
    Posts
    126
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have you checked to see that the directory that is set within the php.ini folder for 'Extensions' is pointing to where your mssql.dll file (or whatever the name of the dll is) is at?

  12. #12
    SitePoint Wizard
    Join Date
    Apr 2004
    Location
    dublin
    Posts
    2,036
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the php_mssql extension is located in C:\PHP\extensions

    and the php.ini file is located in..
    extension_dir = "C:\PHP\extensions"

    But still get error...
    FatFatal error: Call to undefined function: mssql_connect() al error: Call to undefined function: mssql_connect()

  13. #13
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,653
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Then the extension is not loading. Probably because it is missing a library or something. I would check the PHP manual pages on the extension to see if it needed any external libraries.

    PS: Also moving this to the PHP forum so folks there can help you get this rolling.

  14. #14
    SitePoint Wizard
    Join Date
    Apr 2004
    Location
    dublin
    Posts
    2,036
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    reinstalled php4 and same error message. anyone know where might be going wrong. Followed the sitepoint AMP Installation article.

  15. #15
    play of mind Ernie1's Avatar
    Join Date
    Sep 2005
    Posts
    1,252
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    add your PHP directory to PATH, and then don't forget to restart the computer - logoff isn't enough.
    read this
    I had the same problem with php 5 (as apache 2 module)
    Hope it helps
    my mobile portal
    ghiris.ro

  16. #16
    SitePoint Wizard
    Join Date
    Apr 2004
    Location
    dublin
    Posts
    2,036
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    did what you said Ernie1 but continue to get the same error

  17. #17
    play of mind Ernie1's Avatar
    Join Date
    Sep 2005
    Posts
    1,252
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Access Microsoft SQL Server 2000 using PHP, dont't know if this will work for you, but try
    these settings
    Also run this
    PHP Code:
    if(extension_loaded("mssql")) { 
    echo 
    "MSSQL is Loaded<br />"

    else { 
    echo 
    "MSSQL not loaded<br />"

    my mobile portal
    ghiris.ro

  18. #18
    SitePoint Wizard
    Join Date
    Apr 2004
    Location
    dublin
    Posts
    2,036
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    code returns...
    "MSSQL not Loaded"

  19. #19
    SitePoint Wizard
    Join Date
    Apr 2004
    Location
    dublin
    Posts
    2,036
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    uninstalled php4 and installed latest version instead and it now works! thanks guys!!

  20. #20
    play of mind Ernie1's Avatar
    Join Date
    Sep 2005
    Posts
    1,252
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you post the latest settings you appplied to php 5, I presume, and the servers they can be applied to?
    my mobile portal
    ghiris.ro

  21. #21
    SitePoint Zealot
    Join Date
    May 2006
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just wondering but has anyone noticed that he has also forgot the closing ' on the last parameter?

  22. #22
    SitePoint Wizard
    Join Date
    Apr 2004
    Location
    dublin
    Posts
    2,036
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this problem has occurred again!!
    No idea why. Just went to use the website and "Call to undefined function mssql_connect()" appears.

  23. #23
    SitePoint Addict miggl's Avatar
    Join Date
    Feb 2007
    Location
    Los Angeles, CA
    Posts
    286
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question

    I'm having the same issue now. How did you resolve it?

    Running Windows Server 2003 R2, SQL Server 2005, PHP 5.2.3, IIS 6.0.
    Celebrate Liberty, Freedom, and Rights at The Constitutionalist.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •