I have this code that I can run successfully on the command line:

<?php
  echo "Testing...";
  $link = sybase_connect('10.10.1.123' , 'test', 'test123');
  if (!$link) {
        echo "Couldn't make a connection!";
        exit;
  }
  $db = sybase_select_db("testdb", $link);
  //echo $link;
  if (!$db) {
        echo "Couldn't select database!";
        exit;
  }
  $sql = 'SELECT c1 FROM t1';
  $sql_result = sybase_query($sql,$link);
  //echo $sql_result;

  while ($row = sybase_fetch_array($sql_result)) {
  $sname = $row["c1"];
  echo $sname;


  }
?>

However when I try to run it through the browser I get this error:

Fatal error: Call to undefined function sybase_connect() in /var/www/test/ts.php on line 3

I've tried to check both php.ini (For CLI, and Apache2) but frankly I wasn't really sure what exactly I'm looking for. I did a search for sybase on both files and everything looks the same.

Any help please?

    Maybe make a [man]phpinfo/man script and run it both from the command line and the browser and see what's different? Among other things, it will tell you which php.ini file it's using.

      Sounds like PHP isn't reading your php.ini file when called via the browser.

      You mentioned using Apache2... did you add the PHPIniDir directive to the httpd.conf file (assuming you installed PHP as an ISAPI module)?

        I will try to run phpinfo from the cli and the browser. Although everything else besides the sybase works fine through the browser.

          The problem was solved by restarting apache.

            Write a Reply...