Executing Microsoft SQL Server Stored Procedure from PHP on Linux
Learn how to setup, install and configure Apache and PHP on a Linux box to execute MS SQL stored procedures. This extensive article takes you through an in-depth look on how to achieve your ideal environment.
Executing Microsoft SQL Server Stored Procedure from PHP on Linux - Installing FreeTDS (Page 5 of 9 )
From the /public folder, issue:
This will change our working directory to FreeTDS. According to the PHP documentation, if we want to use FreeTDS to connect to a MS SQL Server, we need to append --enable-msdblib to the configure command. For detailed information, you can issue the following command:
This is what I used for the installation of FreeTDS:
Since there is less dependency on the operating system, it is easy to pass this step without any error. Next, we compile the module tree, issue the following:
And install FreeTDS by issuing:
After these 2 steps, you will find a new folder /usr/local/freetds, which contains the new files we’ve just installed. Let’s test our installation, change directory to this folder, and issue:
I have a windows box running MS SQL Server 2000 on it. The machine name is home2k with IP address 192.168.0.212. Append the following part to FreeTDS.conf, and save it:
[home2k] host = 192.168.0.212 port =1433 tds version = 7.0
Change to the bin folder under /usr/local/freetds, and issue:
tsql –S ‘home2k’ –U ‘sa’ –P ‘’
If you see 1> coming out, that means the connection to MS SQL Server is established, you can test further via sending an SQL statement to the SQL Server like the following screen, then exit using the tsql command.