Results 1 to 8 of 8

Thread: FreeTDS and PHP with MSSQL Support Built In, Please?

  1. #1

    Default FreeTDS and PHP with MSSQL Support Built In, Please?

    Can we get this built into the distribution? This would really help set it apart from other distributions that don't have this included.

    And it would most likely make a lot of PHP developer lives a bit easier.

    kthxbai!

  2. #2
    Join Date
    Jun 2008
    Location
    West Yorkshire, UK
    Posts
    3,454

    Default Re: FreeTDS and PHP with MSSQL Support Built In, Please?

    Since mysql with work with Access, you can use mysql rather than MSSQL; that is probably why no one has implemented what you are requesting.

  3. #3

    Default Re: FreeTDS and PHP with MSSQL Support Built In, Please?

    Actually - the whole point would be to provide it during the install so PHP developers, such as myself, can utilize it without having to really modify the installation. It's not a big package. I'd rather not have to recompile PHP onto the distro if I don't have to.

    See what I'm saying? I'm sure I'm not the ONLY person that is kinda forced to use MSSQL.

    Yes, I use MySQL. But the important ERP data I'd like to get to sits on an MSSQL server, and the ERP application isn't something I have control of. Having to recompile PHP just for that is a complete pain. I'd rather just have it installed out of the box.

  4. #4
    Join Date
    Apr 2009
    Location
    South Africa , Johannesburg
    Posts
    6

    Default Re: FreeTDS and PHP with MSSQL Support Built In, Please?

    I support you, also ask for the same in 11.3 milestone-5 just to hear that the "request for features" are closed. Took me days to get is working - lucky the community assisted. We are in a position where we have to work in both environments. RAD programs are a reality and we have to move past the OS to the Application level. I don't want to "compile" and change from the defaults.

    In the same token this applies also "Connecting to the Windows Network" by Active Directory or to Workgroup.

  5. #5

    Default Re: FreeTDS and PHP with MSSQL Support Built In, Please?

    Well after days of searching for the answer...

    Install Apache2 and PHP from SuSE using YaST. Be sure to include the *-devel packages.

    Download the source code for the latest version of freeTDS from FreeTDS.org and install it. I was able to compile it with the following commands:

    ./configure
    make
    make install

    Now edit the file /usr/local/etc/freetds.conf

    Add a new section for your database(s) following the examples already in the file.

    Execute the tsql command to verify that you can connect to the database from FreeTDS. Note that server-name must match the name you entered in freetds.conf.

    tsql -S <server-name> -U <user-name> -P <password>
    1> select count(*) from <tablename>;
    2> go

    123456 <- should be the number of records in <tablename>.
    (1 row affected)
    1> quit

    NOTE: Replace <server-name>, <user-name>, <password> and <table-name> with the proper values for your database. Do not include < or >.

    Create a script to run phpinfo() to verify the current version of PHP. Run the script to verify the version of PHP that you are running. On a stock OpenSuSE installation this will go into the /srv/www/htdocs directory.

    <?php

    phpinfo();

    ?>


    Download the same version of PHP from the php web site.

    For the latest version: PHP: Downloads

    For earlier versions: PHP: Releases

    Untar the downloaded php source file, and cd to the ext/mssql directory within the resulting directory tree.

    Run the following commands to compile just the mssql module:

    phpize
    ./configure
    make

    On my 64 bit SuSE system I had to move the resulting .so file to /usr/lib64/php5/extensions on a 32 bit system I suspect it would be /usr/lib/php5/extensions but I have not tried it.

    Now move to the php5 configuration directory and allow PHP to include your new extension:

    cd /etc/php5/conf.d directory.
    cp mysql.ini mssql.ini

    Now edit the mssql.ini file and change mysql.so to mssql.so.

    Restart Apache.

    Create a php file to test your new installation:

    <?php

    mssql_connect( '<server-name>', '<user-name>', '<password>' );

    $Result = mssql_query( "select count(*) from <table-name>" );

    print_r( mssql_fetch_array( $Result ));

    ?>

    NOTE: Replace <server-name>, <user-name>, <password> and <table-name> with the proper values for your database. Do not include < or >.

    This query should work, and if it does you have access to Ms SQL databases on your OpenSuSE machine.

  6. #6

    Default Re: FreeTDS and PHP with MSSQL Support Built In, Please?

    Thank you for this post rwidmer! It just works!

  7. #7
    Join Date
    Jun 2008
    Location
    Groningen, Netherlands
    Posts
    20,037
    Blog Entries
    14

    Default Re: FreeTDS and PHP with MSSQL Support Built In, Please?

    Quote Originally Posted by tobkab View Post
    Thank you for this post rwidmer! It just works!
    Welcome here, remember where you found this
    ° Appreciate my reply? Click the star and let me know why.

    ° Perfection is not gonna happen. No way.

    https://en.opensuse.org/openSUSE:Board#Members
    http://en.opensuse.org/User:Knurpht
    http://nl.opensuse.org/Gebruiker:Knurpht

  8. #8

    Default Re: FreeTDS and PHP with MSSQL Support Built In, Please?

    Hi,
    found your post here, did like you said - but it doesn't work for me..
    I've took clean just installed openSuSE 11.3 machine, setup FreeTDS 0.83 on it. Tests with tsql is ok. Successfully compiled mssql.so extension. But when running test from php, it never connects to sql server, showing "Unable to connect to server <ipaddressort>" in apache's error log.
    Any ideas where to check?

    Thanks and best regards,
    Michael.

Posting Permissions

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