Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Dear all
I will explain here how to run mssql from linux
1-Install TDS
wget http://www.ibiblio.org/pub/Linux/ALP...tds-stable.tgz
tar freetds-stable.tgz
cd freetds-0.64
./configure --with-tdsver=4.2 --prefix=/usr/local/freetds
make
make install
2-make modification on freetds.conf
vi /usr/local/freetds/etc/freetds.conf
[server]
host = <server mssql >
port = 1433
tds version = 4.2
3-Install php or recompile php
./configure' '--with-apxs=/usr/local/apache/bin/apxs' '--prefix=/usr/local' '--with-xml' '--enable-bcmath' '--enable-calendar' '--enable-ftp' '--with-gd' '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr' '--with-xpm-dir=/usr/X11R6' '--with-gettext' '--enable-mbstring' '--enable-mbstr-enc-trans' '--enable-mbregex' '--enable-magic-quotes' '--with-mysqli' '--with-mysql=/usr' '--enable-discard-path' '--with-pear' '--enable-safe-mode' '--enable-sockets' '--enable-track-vars' '--with-ttf' '--with-freetype-dir=/usr' '--enable-gd-native-ttf' '--with-zlib' '--with-mssql=/usr/local/freetds'
make
make install
4-Restart apache
5-To check mssql make this page
<?php
$db = @mssql_connect("server","username","password") or die("Unable to connect to server");
mssql_select_db("dbname");
echo "<br>"."Thanks";
?>
Actually this will not work for me. At the ./configure line, I keyed in exactly as stated with the --with-mssql=/usr/local/freetds and it errors out that /usr/local/freetds is not a freetds installation directory.
Interesting, your right, but I cannot find tds.h anywhere. I did a ./configure, make, and make install of the latest stable version into /usr/local/freetds, is this not where the tds.h file is? How do I find it?
My goal is to create the mssql.so extension so I can add mssql support to PHP. I know once I copy the .so file to the extension directory or wherever it goes, then I add the extension=mssql.so to the php.ini file.
I really don't want to recompile PHP because I would lose all my other vital settings to it.
Our web server uses Redhat enterprise 4 but I don't know what the packing system is for it. Yeah I know I'm kinda dumb with this.
Download and extract the same version of PHP you currently are running from php.net.
Code:
cd /path_to_source/ext/mssql/
phpize
./configure
make
Locate the other PHP modules on your system and copy the new mssql.so to that directory. An easy way to check this is with "grep extension_dir /etc/php.ini". /usr/lib/php4/ may or may not be correct for your server so make sure to check.
Code:
cp module/mssql.so /usr/lib/php4/
echo 'extension=mssql.so' > /etc/php.d/mssql.ini
service httpd restart
I forgot the mention that I'm running PHP 5.2.6 currently and I downloaded it's source for the phpize step. That's where the "FreeTDS not installed error" occurred when trying to make the MSSQL module via the ./configure step.
ok I made some progress, the 0.82 version of freetds doesn't seem to work here so I went back to 0.63, and I was able to make the mssql.so file and it copied to the php extensions directory. Upon adding it to the php.ini file with extension=mssql.so it seemed to have no effect. The phpinfo() does not show MSSQL support and the test page still shows mssql_connect as an undefined function. And of course I did restart apache.
crap. ok I got past that error and now php recognizes mssql support. but I can't connect to my mssql server. I have to access it by it's ip address and I already have port 1433 open.
ok I made some progress, the 0.82 version of freetds doesn't seem to work here so I went back to 0.63, and I was able to make the mssql.so file and it copied to the php extensions directory. Upon adding it to the php.ini file with extension=mssql.so it seemed to have no effect. The phpinfo() does not show MSSQL support and the test page still shows mssql_connect as an undefined function. And of course I did restart apache.
im stuck exactly on that part, how did you solve it?
im stuck exactly on that part, how did you solve it?
I really had to fight it. What I did was download the source of the 0.63 version of FreeTDS. The higher versions seem to require different instructions not available anywhere. Also, I am using SQL Server 2005 Express for this and connecting to it from Redhat Enterprise 4.
Anyways, After doing the tar extraction of the 0.63 source, go to that 0.63 directory, then:
Code:
./configure --with-tdsver=8.0 --prefix=/usr/local/freetds
make
make install
Then make the appropriate modifications to the freetds.conf file.
Next, download the PHP source files from php.net that matches your current PHP version to your /root directory. tar extract the php source, then change to its directory like you did with FreeTDS above, except this time you'll go a step further by changing to the php-source/ext/mssql directory.
In that directory, do this:
Code:
phpize
./configure --with-mssql
make
make install
This should automatically add mssql.so to your php extension directory. If it did not, be sure to copy it to the right place. Last, go to your current php.ini file which is usually in /usr/local/lib and add to it this line:
Code:
extension=mssql.so
Restart apache as indicated in the instructions. Also, like the others said, do a phpinfo(); on a test page to make sure the MSSQL functions are working, and then finally be sure that you have port 1433 open on your SQL server and firewall and that MSSQL is configured to listen on TCP.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.