Installing php, mssql on centos5.0 - cant connect

Discussion in 'HOWTO-Related Questions' started by ittec, Nov 26, 2007.

  1. ittec

    ittec New Member

    About this tutorial:


    i applied the HowToForge's tutorial of PHP5 and MSSQL but i can't connect to SQL Server(2005 or 2000). I tested the connection with this script:

    $hostdbnot "xxx";
    $userdbnot "xxx";
    $passdbnot "xxx";
    $basedbnot "xxx";

    $dbgamesnot mssql_connect($hostdbnot$userdbnot$passdbnot);
    if (
    $dbgamesnot) echo 'Great!';
    else echo 

    The code returns "Damn" string. I have a php scritp with phpinfo() and this function returns as MSSQL is enabled.

    MSSQL Support	               enabled
    Active Persistent Links 	0
    Active Links 	                   0
    Library version 	           FreeTDS
    Are there any other action to try or test? Its very strange that phpinfo() shows MSSQL as enabled but its impossible to connect to Sql Server.

  2. falko

    falko Super Moderator ISPConfig Developer

    Any errors in Apache's error log? Are you able to connect to MSSQL on the command line?
  3. ittec

    ittec New Member

    from command line

    Hi falko

    i read yours answers and advices many times when ive found information about another issues :)

    I tried to connect SQL server from comand line using tsql command (/usr/local/bin/tsql) but i cann't connect. I think this command try the hability of FreeTDS to connect to SQL Server.

    # tsql -H [IP HOST] -p 1433 -U sa


    locale is "en_US.UTF-8"
    locale charset is "UTF-8"
    Msg 20004, Level 9, State 0, Server OpenClient, Line 0
    Read from SQL server failed.
    Msg 20014, Level 9, State 0, Server OpenClient, Line 0
    Login incorrect.
    There was a problem connecting to the server
    But the password is right. I don't see nothing in apache log error. Did i forgot something in freetds or odbc configuration?

    Thanks :)
  4. falko

    falko Super Moderator ISPConfig Developer

    Unfortunately I'm no MSSQL expert... :(
    Is MSSQL running?
  5. ittec

    ittec New Member

    MSSQL enabled

    Unfortunately I'm no MSSQL expert
    Like me :p

    MSSQL is enabled but i can't connect to any SQL server by command or php script. I think the problem is a FREETDS configuration or maybe odbc.ini setup, but im totally lost.

    The unbelieveable is MSSQL shows as enabled with phpinfo( ) :confused:

    Any ideas?

    Thanks Falko by your interest
  6. ittec

    ittec New Member


    Well with the help of Linux Gods we finally can connect to SQL Server 2000.

    1) We followed the HowToForge tutorial

    2) We experimented problems with Freetds. We installed well MSSQL extension but we couldn't connect to MSSQL from command line or php script. I found the solution of these issue here

    The problem was i install Freetds from RPM with yum and didn't specifiy the parameters manually. I remove freetds rpm installation first, and then, install freetds manuall with parameters likie tdserver=8.0 etc. Later i copied the files of new installation to default directorys of a normal freetds installation.

    Restart apache, and .... we could connect.

    Thanks :)

Share This Page