title: php odbc_connect to mssql works in linux/ubuntu command line not browser
body: <p>I really feel like I have done an exhaustive search on this matter, found similar issues and have tried a number of things without success, so I am for the first time posting a question here:</p>
  
  <p>I do a lot of web pages/web programming (PHP/jQuery mostly) and host these pages on my digital library department's Drupal/Ubuntu Server. I just code them and post them via Dreamweaver, as I don't have much use for the Drupal front end. I just need the server for my pages. </p>
  
  <p>Anyway, I am wanting to make some PHP pages that can connect to our library catalog, so I have been working from the command line of the Drupal/Ubuntu server. I installed unixODBC, had some troubles, installed FreeTDS, set up the drivers and the DSN. </p>
  
  <p>Finally...</p>
  
  <ol>
  <li><p>I was able to get a connection to our catalog via tsql and run a query. </p></li>
  <li><p>I made a basic PHP script to test the connection:</p>
  
  <ul>
  <li><p>It works from the Ubuntu command line of the server (connection successful). </p></li>
  <li><p>It doesn't work when I load it in a browser. I get the dreaded: </p></li>
  </ul></li>
  </ol>
  
  <blockquote>
    <p>Warning: odbc_pconnect(): SQL error: [unixODBC][Driver Manager]Data source name not found, and no default driver specified, SQL state IM002 in SQLConnect in /var/www/mydirectory/mytestpage.php on line 15</p>
  </blockquote>
  
  <p><strong>UPDATE:</strong> I installed a test Ubuntu Server in a partition on my laptop, where I started clean, installed Apache2/PHP5(with mssql and odbc modules, etc)/FreeTDS, etc. I got a tsql connection. I made the basic PHP script and ran it successfully from the command line. Then I navigated to the php page from a browser and <em>it worked!</em> I still need to get this to happen on the Drupal server version, but now I have at least narrowed down the issue to something on the Drupal server.</p>
  
  <p>I searched and found such possible causes as:</p>
  
  <ol>
  <li><p>File permissions, which I think I got corrected, but no go</p></li>
  <li><p>That maybe I had set up a User DNS and not a System DNS which I tried my best to correct with the proper "odbcinst" command options</p></li>
  <li><p>That maybe php needs to be running in CGI mode instead of as a module. But that seemed unlikely from what I read. And I am not sure how that would affect Drupal. (There are limits to the system wide changes I should make here.) </p></li>
  <li><p>A number of people said it was SElinux blocking Apache from displaying the page in the browser, but temporarily disabling SElinux didn't work.</p></li>
  </ol>
  
  <p>Thanks for any assistance!</p>