0

I wanted to connect a SQL database to my PHP file, but when I run the odbc_connect function, it gives an error:

Fatal error: Uncaught Error: Call to undefined function odbc_connect()

This is my code:

$connection = odbc_connect('MyDatabaseName', 'MyUsername', 'MyPassword');
aynber
  • 22,380
  • 8
  • 50
  • 63
WebDev001
  • 91
  • 1
  • 1
  • 6
  • [click here](https://www.google.com/search?q=Fatal+error%3A+Uncaught+Error%3A+Call+to+undefined+function+odbc_connect) for existing information on solving this error. – ADyson Aug 10 '21 at 06:39
  • I removed the tag since this is not related to the SQL _language_. You can add a tag for the dbms used instead. – jarlh Aug 10 '21 at 06:39
  • 2
    Does this answer your question? [Call to undefined function odbc\_connect() php 7](https://stackoverflow.com/questions/34321203/call-to-undefined-function-odbc-connect-php-7) – pyeR_biz Aug 11 '21 at 06:20

1 Answers1

0

try using this:

Linux systems based on debian/ubuntu

sudo apt update
sudo apt upgrade
sudo apt install php-odbc

Linux systems based on redhat/centos

yum update
dnf install php-odbc

Right after if you are using nginx:

systemctl restart nginx

Or if not, if you are using apache:

systemctl restart apache2

Or use:

systemctl restart your-program